arrow-core-data / arrow.core / orNull

orNull

fun <B> EitherOf<*, B>.orNull(): B?

Returns the value from this Either.Right or null if this is a Either.Left.

Example:

Right(12).orNull() // Result: 12
Left(12).orNull()  // Result: null

fun <E, A> ValidatedOf<E, A>.orNull(): A?

Return the Valid value, or null if Invalid

Do you like Arrow?

Arrow Org
<