Skip to content

Instantly share code, notes, and snippets.

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 SylvainHocq/d6a6ad547c5cfd25ac7482f1a98c74ea to your computer and use it in GitHub Desktop.
Save SylvainHocq/d6a6ad547c5cfd25ac7482f1a98c74ea to your computer and use it in GitHub Desktop.
inline fun <A, B, R> ifNotNull(a: A?, b: B?, code: (A, B) -> R) {
if (a != null && b != null) {
code(a, b)
}
}
inline fun <A, B, C, R> ifNotNull(a: A?, b: B?, c: C?, code: (A, B, C) -> R) {
if (a != null && b != null && c != null) {
code(a, b, c)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment