@NonNull abstract fun <B : Any!> map(@NonNull function: (in A) -> out B): Maybe<B>
Maps Just value or passes Nothing. In case of Just, function that is passed to this method will be called with the stored value, the result of this operation will be assigned to a new Maybe. In case of Nothing, map will not invoke the passed function and just pass the Nothing again.
function
- (in A) -> out B: Function that is applied to the value stored in the Maybe.
- Type of the resulting Maybe after mapping.
Return
Maybe<B>: Just
if the value was mapped, Nothing
otherwise.