Skip to content

Instantly share code, notes, and snippets.

@tiiime
Created May 26, 2018 16:31
Show Gist options
  • Save tiiime/9a2edb18f7f214b42d24b50ec28d2f46 to your computer and use it in GitHub Desktop.
Save tiiime/9a2edb18f7f214b42d24b50ec28d2f46 to your computer and use it in GitHub Desktop.
一些扩展
/**
* 链式判空
*/
inline fun <reified T> T?.ifNull(block: () -> Unit): T? {
if (this == null) block()
return this
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment