commonMain.extensions.Any.kt Maven / Gradle / Ivy
package io.fluidsonic.stdlib
import kotlin.contracts.*
internal expect inline fun T.freeze(): T
public inline fun T?.ifNull(defaultValue: () -> T): T {
contract {
callsInPlace(defaultValue, InvocationKind.AT_MOST_ONCE)
}
return this ?: defaultValue()
}