arrow-core-data / arrow.core / getOrHandle
inline fun <A, B>
EitherOf
<A, B>.getOrHandle(default: (A) -> B): B
Returns the value from this Either.Right or allows clients to transform Either.Left to Either.Right while providing access to the value of Either.Left.
Example:
Right(12).getOrHandle { 17 } // Result: 12
Left(12).getOrHandle { it + 5 } // Result: 17
Do you like Arrow?
✖