AM
Size: a a a
AM
AM
SB
SB
D
K
bar?.let { null } ?: Foo()
K
D
K
EnterpriseFacadeBuilder
если так проще. Это реальная ситуация создания объекта)D
EnterpriseFacadeBuilder
если так проще. Это реальная ситуация создания объекта)D
foo = onlyIfNull(bar) { Foo() }
fun <T> onlyIfNull(obj: Any?): T? = ...
AO
AM
I
inline fun <T> Boolean.then(onTrue: () -> T) = if (this) onTrue() else null
SB
inline fun <T> T.alsoRunIf(condition: Boolean, block: T.() -> T): T {
if (condition)
return block(this)
return this
}
I
fun <T> T.alterIf(condition: Boolean, alter: T.() -> T) = if (condition) alter() else this
AO
VP
inline fun <T> Boolean.then(onTrue: () -> T) = if (this) onTrue() else null
SB
VP