sdk-common / com.tomtom.online.sdk.common.functional / Maybe / orElse

orElse

@NonNull abstract fun orElse(@NonNull defaultMaybe: Maybe<A>): Maybe<A>

Returns this Maybe if it's a Just or the given default argument if this is a Nothing.

Parameters

defaultMaybe - Maybe<A>: This value will be returned in case of Nothing.

Return
Maybe<A>: this Maybe if Just, default value otherwise.

@NonNull abstract fun orElse(@NonNull supplier: Supplier<Maybe<A>!>): Maybe<A>

Returns a Just or a value returned by the Supplier wrapped in a Maybe.

Parameters

supplier - Supplier<Maybe<A>!>: value returned by this Supplier will be returned in case of a Nothing.

Return
Maybe<A>: Just or value returned by Supplier wrapped in a Maybe