EitherX<K, V> extension
Extension on Either<K, V> providing additional utility methods.
This extension adds methods to Either<K, V> objects, allowing for more
expressive handling of Either types, particularly in scenarios where the
value might be null.
- on
-
- Either<
K, V>
- Either<
Methods
-
flatMapOrNull<
R> (Either< K, R> f(V)) → Either<K, R> ? -
Available on Either<
Applies a function returning anK, V> , provided by the EitherX extensionEitherto the value if theEitherisRight; otherwise, returns null. -
getOrNull(
) → V? -
Available on Either<
Returns the value if theK, V> , provided by the EitherX extensionEitherisRight; otherwise, returns null. -
getValueOrElse(
V defaultValue) → V -
Available on Either<
Returns the value if theK, V> , provided by the EitherX extensionEitherisRight; otherwise, returns the provided default value. -
mapOrNull<
R> (R f(V)) → R? -
Available on Either<
Applies a function to the value if theK, V> , provided by the EitherX extensionEitherisRight; otherwise, returns null.