//arrow-core/arrow.core/orNull

orNull

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

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

Example:

import arrow.core.Either.Right
import arrow.core.Either.Left

fun main() {
  Right(12).orNull() // Result: 12
  Left(12).orNull()  // Result: null
}

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

Return the Valid value, or null if Invalid

Do you like Arrow?

Arrow Org
<