-
-
Method Summary
Modifier and Type Method Description final BooleanhasError()Whether or not this contains an E final BooleanhasValue()Whether or not this contains a value final <B extends Any> EOr<B>map(Function1<A, B> f)Converts value in this, if it exists, using given mapping function to make a new EOr final <B extends Any> EOr<B>flatMap(Function1<A, EOr<B>> f)Computes a new EOr using value in this, if it exists, with given flat mapping function final EOr<A>mapError(Function1<E, E> f)Converts E in this, if it exists, using given mapping function to make a new EOr final <B extends Any> Bfold(Function1<E, B> ifFailure, Function1<A, B> ifSuccess)Folds this into a single value, handling both E and value conversions with given functions final <B extends Any> EOr<B>andThen(Function0<EOr<B>> next)Provides a next EOr if this one has a value, ignoring the value final <U extends Any> EOr<A>onError(Function1<E, U> f)Performs a side-effect using error in this, if it exists final <U extends Any> EOr<A>onValue(Function1<A, U> f)Performs a side-effect using value in this, if it exists final <U extends Any> EOr<A>forEach(Function1<A, U> f)Alias of onValue final EOr<A>filter(Function1<A, Boolean> condition, Function1<A, E> filteredError)Filters this EOr by value in it, if it exists, using given function EgetError()AgetValue()-
-
Method Detail
-
map
final <B extends Any> EOr<B> map(Function1<A, B> f)
Converts value in this, if it exists, using given mapping function to make a new EOr- Parameters:
f- Mapping function
-
flatMap
final <B extends Any> EOr<B> flatMap(Function1<A, EOr<B>> f)
Computes a new EOr using value in this, if it exists, with given flat mapping function- Parameters:
f- Flat mapping function
-
mapError
final EOr<A> mapError(Function1<E, E> f)
Converts E in this, if it exists, using given mapping function to make a new EOr- Parameters:
f- E mapping function
-
fold
final <B extends Any> B fold(Function1<E, B> ifFailure, Function1<A, B> ifSuccess)
Folds this into a single value, handling both E and value conversions with given functions- Parameters:
ifFailure- Conversion function for EifSuccess- Conversion function for value
-
andThen
final <B extends Any> EOr<B> andThen(Function0<EOr<B>> next)
Provides a next EOr if this one has a value, ignoring the value- Parameters:
next- Next EOr in case this one has a value
-
onError
final <U extends Any> EOr<A> onError(Function1<E, U> f)
Performs a side-effect using error in this, if it exists- Parameters:
f- Side-effecting function
-
onValue
final <U extends Any> EOr<A> onValue(Function1<A, U> f)
Performs a side-effect using value in this, if it exists- Parameters:
f- Side-effecting function
-
filter
final EOr<A> filter(Function1<A, Boolean> condition, Function1<A, E> filteredError)
Filters this EOr by value in it, if it exists, using given function- Parameters:
condition- Filtering functionfilteredError- E conversion function
-
-
-
-