ifNotNull
ifNotNull execute when value isn't null.
Example:
val value: String? = null
value.ifNotNull { ... } // null
value.ifNotNull {
...
"i am not null"
} // null
val value2 = "hello"
value2.ifNotNull { ... } // Unit
value2.ifNotNull {
...
"i am not null"
} // i am not null
Content copied to clipboard
Since
1.1.0
Return
value or Unit