Some

data class Some<T>(val value: T) : Optional<T>

The case of Optional holding exactly one, non-null value.

Constructors

Link copied to clipboard
constructor(value: T)

Properties

Link copied to clipboard

Whether this Optional holds no value, i.e. whether it is None. Always !isPresent.

Link copied to clipboard
open override val isPresent: Boolean

Whether this Optional holds a value, i.e. whether it is a Some.

Link copied to clipboard
open override val value: T

The contained value, or null if this is None.

Functions

Link copied to clipboard
open override fun filter(predicate: (T) -> Boolean): Optional<out T>

Returns this instance if value satisfies predicate, or None otherwise.

Link copied to clipboard
open override fun <R> map(function: (T) -> R): Optional.Some<R>

Applies function to value, returning a Some holding the result.

Link copied to clipboard
open override fun toSequence(): Sequence<T>

Returns a single-element Sequence containing value.

Link copied to clipboard
open override fun toString(): String