Option$NoneExtension<T> extension

Option methods that could not be added to the main Option class.

Dev Note: This is because things like option.xor(Some(..)), where option is really a None, would cause runtime exceptions since it was valid code, but Some

on

Methods

or(Option<T> other) Option<T>

Available on Option<T>, provided by the Option$NoneExtension extension

Returns the option if it contains a value, otherwise returns other
orElse(Option<T> f()) Option<T>

Available on Option<T>, provided by the Option$NoneExtension extension

Returns the option if it contains a value, otherwise calls f and returns the result.
unwrapOr(T defaultValue) → T

Available on Option<T>, provided by the Option$NoneExtension extension

Returns the contained Some value or a provided default.
unwrapOrElse(T f()) → T

Available on Option<T>, provided by the Option$NoneExtension extension

Returns the option if it contains a value, otherwise returns other.
xor(Option<T> other) Option<T>

Available on Option<T>, provided by the Option$NoneExtension extension

Returns Some if exactly one of this or other is Some, otherwise returns None.