apatrida
09/24/2015, 9:36 PMpublic 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
name.whenNotNull { cache.getByName(name) } ?: defaultValue