Skip to content

Instantly share code, notes, and snippets.

@ditn
Last active April 26, 2018 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ditn/f0b7a385fe749174efb9d007f7b2586f to your computer and use it in GitHub Desktop.
Save ditn/f0b7a385fe749174efb9d007f7b2586f to your computer and use it in GitHub Desktop.
naive_high_order_extension
private fun NotificationCompat.Builder.ternaryBuilder(
predicate: () -> Boolean,
trueFunc: NotificationCompat.Builder.() -> NotificationCompat.Builder,
falseFunc: NotificationCompat.Builder.() -> NotificationCompat.Builder
): NotificationCompat.Builder = if (predicate()) this.trueFunc() else this.falseFunc()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment