Jason deBono
listOfNotNull( if (somethingNullable == null) {ReturnValue} else null, ... )
inline fun <T, R> T?.whenNull(block: () -> R): R? = if (this == null) block() else null
listOfNotNull( somethingNullable.whenNull {ReturnValue}, ... )
nanodeath
listOfNotNull( ReturnValue.takeIf { somethingNullable == null } )
Francesc
somethingNullable ?: run { add(ReturnValue) }
buildList
?:
A modern programming language that makes developers happier.