commonMain.Optional.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fluid-stdlib-macosx64 Show documentation
Show all versions of fluid-stdlib-macosx64 Show documentation
Potentially useful Kotlin standard library additions
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
}
}