Either
The Either type represents a value of one of two possible types (a disjoint union), referred to by left or right .
Factory methods Either#left(Object) and Either#right(Object) correspond to the two possible values.
API
Either.java
interface Either<L, R> {
Either<L, R> left(L left)
Either<L, R> right(R right)
Optional<L> left()
Optional<R> right()
L leftIfAny()
R rightIfAny()
boolean isLeft()
boolean isRight()
Either<T, R> mapLeft(Function<L, T> leftMapper)
Either<L, T> mapRight(Function<R, T> rightMapper)
Either<X, Y> map(Function<L, X> leftMapper, Function<R, Y> rightMapper)
T fold(BiFunction<L, R, T> biMapper)
T fold(Function<L, T> leftMapper, Function<R, T> rightMapper)
void accept(Consumer<L> leftConsumer, Consumer<R> rightConsumer)
}