commonMain.Optional.kt Maven / Gradle / Ivy
package io.fluidsonic.stdlib
data class Optional(
val value: Value? = null
) {
init {
freeze()
}
inline fun mapValue(mapping: (Value) -> MappedValue?) =
Optional(value?.let(mapping))
companion object {
private val empty = Optional()
@Suppress("UNCHECKED_CAST")
fun empty() = empty as Optional
}
}