None

object None : Option<Nothing>

Functions

Link copied to clipboard
inline fun <A> Option<A>.combine(other: Option<A>, combine: (A, A) -> A): Option<A>
Link copied to clipboard
operator fun <A : Comparable<A>> Option<A>.compareTo(other: Option<A>): Int
Link copied to clipboard
inline fun filter(predicate: (Nothing) -> Boolean): Option<Nothing>

Returns this

$option if it is nonempty '''and''' applying the predicate $

p to this

$option's value returns true. Otherwise, return $

none.

Link copied to clipboard
inline fun <B> Option<*>.filterIsInstance(): Option<B>

Returns an Option containing all elements that are instances of specified type parameter B.

Link copied to clipboard
inline fun filterNot(predicate: (Nothing) -> Boolean): Option<Nothing>

Returns this

$option if it is nonempty '''and''' applying the predicate $

p to this

$option's value returns false. Otherwise, return $

none.

Link copied to clipboard
inline fun <B> flatMap(f: (Nothing) -> Option<B>): Option<B>

Returns the result of applying

$f to this $

option's value if this

$option is nonempty. Returns $

none if this

$option is empty. Slightly different from map in that $

f is expected to return an

$option (which could be $

none).

Link copied to clipboard
Link copied to clipboard
inline fun <R> fold(ifEmpty: () -> R, ifSome: (Nothing) -> R): R
Link copied to clipboard
inline fun <T> Option<T>.getOrElse(default: () -> T): T

Returns the option's value if the option is nonempty, otherwise return the result of evaluating default.

Link copied to clipboard

Returns the encapsulated value A if this instance represents Some or null if it is None.

Link copied to clipboard

Returns true if the option is None, false otherwise.

Link copied to clipboard

Returns true if the option is Some, false otherwise.

inline fun isSome(predicate: (Nothing) -> Boolean): Boolean

Returns true if this option is nonempty '''and''' the predicate

$p returns true when applied to this $

option's value. Otherwise, returns false.

Link copied to clipboard
inline fun <B> map(f: (Nothing) -> B): Option<B>

Returns a [Some<

$B>] containing the result of applying $

f to this

$option's value if this $

option is nonempty. Otherwise return $none.

Link copied to clipboard
inline fun onNone(action: () -> Unit): Option<Nothing>

The given function is applied as a fire and forget effect if this is a None. When applied the result is ignored and the original None value is returned

Link copied to clipboard
inline fun onSome(action: (Nothing) -> Unit): Option<Nothing>

The given function is applied as a fire and forget effect if this is a some. When applied the result is ignored and the original Some value is returned

Link copied to clipboard
inline fun <A> Option<A>.recover(recover: SingletonRaise<None>.() -> A): Option<A>

Recover from any None if encountered.

Link copied to clipboard
inline fun <L> toEither(ifEmpty: () -> L): Either<L, Nothing>
Link copied to clipboard
Link copied to clipboard
fun <K, V> Option<Pair<K, V>>.toMap(): Map<K, V>
Link copied to clipboard
open override fun toString(): String