Package de.scravy.bedrock
Class Either<L,R>
java.lang.Object
de.scravy.bedrock.Either<L,R>
- All Implemented Interfaces:
Serializable,Comparable<Either<L,R>>
- Direct Known Subclasses:
Either.Left,Either.Right
@Immutable public abstract class Either<L,R> extends Object implements Serializable, Comparable<Either<L,R>>
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEither.Left<L,R>static classEither.Right<L,R> -
Constructor Summary
Constructors Constructor Description Either() -
Method Summary
Modifier and Type Method Description abstract <T> Tfold(Function<L,T> f, Function<R,T> g)abstract voidforEachLeft(Consumer<L> f)abstract voidforEachRight(Consumer<R> f)abstract Optional<Either.Left<L,R>>getLeft()abstract Optional<L>getLeftValue()abstract Optional<Either.Right<L,R>>getRight()abstract Optional<R>getRightValue()abstract ObjectgetValue()abstract booleanisLeft()abstract booleanisRight()static <L, R> Either<L,R>left(L value)abstract <L2> Either<L2,R>mapLeft(Function<L,L2> f)abstract <R2> Either<L,R2>mapRight(Function<R,R2> f)static <L, R> Either<L,R>right(R value)
-
Constructor Details
-
Either
public Either()
-
-
Method Details
-
getValue
-
mapLeft
-
mapRight
-
forEachLeft
-
forEachRight
-
isLeft
public abstract boolean isLeft() -
isRight
public abstract boolean isRight() -
getLeft
-
getRight
-
getLeftValue
-
getRightValue
-
fold
-
left
-
right
-