or

fun or(supplier: () -> Optional<T?>): Optional<T?>

If a value is present, returns an Optional describing the value, otherwise returns an Optional produced by the supplying function.

Return

an Optional describing the value if present, or the Optional produced by the supplier if not.

Parameters

supplier

the supplying function that produces an Optional to be returned.

Throws

if the supplier produces a null result.