that case of "if something is not null act on it",...
# announcements
a
that case of "if something is not null act on it", Klutter has
Copy code
public inline fun <T: Any, R: Any> T?.whenNotNull(thenDo: (T) -> R?): R? = if (this == null) null else thenDo(this)
so you can still chain if retuning a null from the lambda
Copy code
name.whenNotNull { cache.getByName(name) } ?: defaultValue