Optional

sealed class Optional<T> : Any

Fields

Name Description
abstract value: T?
abstract isPresent: Boolean
val isAbsent: Boolean

Methods

map

abstract fun <R> map(function: (T)->R): Optional<R>

Parameters

Name Description
function: (T)->R

ReturnValue

Name Description
Optional<R>

filter

abstract fun filter(predicate: (T)->Boolean): Optional<T>

Parameters

Name Description
predicate: (T)->Boolean

ReturnValue

Name Description
Optional<T>

toSequence

abstract fun toSequence(): Sequence<T>

ReturnValue

Name Description
Sequence<T>

toString

abstract fun toString(): String

ReturnValue

Name Description
String

CompanionObject

Optional

sealed class Optional<T> : Any

Methods

some

fun <T> some(value: T): Some<T>

Parameters

Name Description
value: T

ReturnValue

Name Description
Some<T>

of

fun <T> of(value: T?): Optional<T>

Parameters

Name Description
value: T?

ReturnValue

Name Description
Optional<T>

none

fun <T> none(): Optional<T>

ReturnValue

Name Description
Optional<T>