MaybeImpl<T> extension

Impl for Maybe

on

Properties

has bool

Available on Maybe<T>?, provided by the MaybeImpl extension

Get the Value if it has
no setter
isNone bool

Available on Maybe<T>?, provided by the MaybeImpl extension

Returns true if the this is a None value
no setter
isSome bool

Available on Maybe<T>?, provided by the MaybeImpl extension

Returns true if the this is a Some value
no setter
val → T?

Available on Maybe<T>?, provided by the MaybeImpl extension

no setter

Methods

and<U>(Maybe<U>? other) Maybe<U>?

Available on Maybe<T>?, provided by the MaybeImpl extension

Returns None if the this is None, otherwise returns other
andThen<U>(Maybe<U>? f(T val)) Maybe<U>?

Available on Maybe<T>?, provided by the MaybeImpl extension

Returns None if the this is None, otherwise calls f with the wrapped value and returns the result
defaultVal(T v) Maybe<T>?

Available on Maybe<T>?, provided by the MaybeImpl extension

Set a default value when it is None(null)
defaultValFn(T fn()) Maybe<T>?

Available on Maybe<T>?, provided by the MaybeImpl extension

Set a default value when it is None(null)
flatMap<U>(Maybe<U>? f(T val)) Maybe<U>?

Available on Maybe<T>?, provided by the MaybeImpl extension

Returns None if the this is None, otherwise calls f with the wrapped value and returns the result
map<U>(U f(T val)) Maybe<U>?

Available on Maybe<T>?, provided by the MaybeImpl extension

Maps an Maybe
none<R>(R none()) Maybe<R>?

Available on Maybe<T>?, provided by the MaybeImpl extension

When it not has Value Return Some(none(it))
or(Maybe<T>? other) Maybe<T>?

Available on Maybe<T>?, provided by the MaybeImpl extension

Returns this if this contains a value, otherwise returns other
orElse(Maybe<T>? f()) Maybe<T>?

Available on Maybe<T>?, provided by the MaybeImpl extension

Returns this if this contains a value, otherwise calls f and returns the result
some<R>(R some(T val)) Maybe<R>?

Available on Maybe<T>?, provided by the MaybeImpl extension

fMap
then<U>(U f(T val)) Maybe<U>?

Available on Maybe<T>?, provided by the MaybeImpl extension

Maps an Maybe
when<R>({R some(T val)?, R none()?}) Maybe<R>?

Available on Maybe<T>?, provided by the MaybeImpl extension

Pattern matching
xor(Maybe<T>? other) Maybe<T>?

Available on Maybe<T>?, provided by the MaybeImpl extension

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