mapNotNull

inline fun <B> mapNotNull(f: (A) -> B?): Option<B>

Deprecated

This API is niche and will be removed in the future. If this method is crucial for you, please let us know on the Arrow Github. Thanks! https://github.com/arrow-kt/arrow/issues Prefer using the Option DSL, or fold or map

Replace with

import arrow.core.Option.Companion.fromNullable
flatMap { fromNullable(f(it)) }

Returns $none if the result of applying $f to this $option's value is null. Otherwise returns the result.

Parameters

f

the function to apply.