sealed class Option<out T : Any>
None |
object None : Option<Nothing> |
Some |
class Some<out T : Any> : Option<T> |
absent |
val absent: Boolean |
present |
val present: Boolean |
value |
abstract val value: T |
filter |
fun filter(predicate: (T) -> Boolean): Option<T> |
flatMap |
fun <U : Any> flatMap(transformer: (T) -> Option<U>): Option<U> |
fold |
fun fold(left: (T) -> Unit, right: () -> Unit): Option<T> |
ifAbsent |
fun ifAbsent(right: () -> Unit): Option<T> |
ifPresent |
fun ifPresent(left: (T) -> Unit): Option<T> |
map |
fun <U : Any> map(transformer: (T) -> U): Option<U> |
not |
operator fun not(): Boolean |
toLeft |
fun <U : Any> toLeft(right: U): Either<T, U> |
toRight |
fun <U : Any> toRight(left: U): Either<U, T> |
toTry |
fun toTry(exception: () -> Exception = { NullPointerException() }): Try<T> |
invoke |
operator fun <T : Any> invoke(value: T?): Option<T> |
orElse |
fun <T : Any> Option<T>.orElse(other: T): T |
orElseGet |
fun <T : Any> Option<T>.orElseGet(other: () -> T): T |
orElseThrow |
fun <T : Any> Option<T>.orElseThrow(exception: () -> Exception): T |
toList |
fun <T : Any> Option<T>.toList(): List<T> |
toSequence |
fun <T : Any> Option<T>.toSequence(): Sequence<T> |
toSet |
fun <T : Any> Option<T>.toSet(): Set<T> |
None |
object None : Option<Nothing> |
Some |
class Some<out T : Any> : Option<T> |