L - type of the left sideR - type of the right sidepublic abstract class Either<L,R> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Either.LeftProjection<L,R>
Projects an Either into a Left.
|
static class |
Either.RightProjection<L,R>
Projects an Either into a Right.
|
| Constructor and Description |
|---|
Either() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
equals(Object object)
Returns true if this and object are both either a Left or a Right, and both their
containing values are equal as determined by their equal methods.
|
abstract <X> X |
fold(Function<L,X> leftMapper,
Function<R,X> rightMapper)
Applies leftMapper if this is a Left or rightMapper if this is a Right.
|
abstract int |
hashCode() |
abstract boolean |
isLeft() |
boolean |
isRight() |
abstract <X> Either<X,R> |
joinLeft(Function<L,Either<X,R>> leftJoiner)
Joins an Either through Left.
|
abstract <X> Either<L,X> |
joinRight(Function<R,Either<L,X>> rightJoiner)
Joins an Either through Right.
|
Either.LeftProjection<L,R> |
left() |
static <L,R> Either<L,R> |
left(L value) |
Either.RightProjection<L,R> |
right() |
static <L,R> Either<L,R> |
right(R value) |
abstract String |
toString() |
public abstract boolean isLeft()
public boolean isRight()
public Either.LeftProjection<L,R> left()
public Either.RightProjection<L,R> right()
public abstract boolean equals(Object object)
public abstract <X> X fold(Function<L,X> leftMapper, Function<R,X> rightMapper)
X - the resulting type of applying the functionleftMapper - the function to apply if this is a LeftrightMapper - the function to apply if this is a Rightpublic abstract <X> Either<X,R> joinLeft(Function<L,Either<X,R>> leftJoiner)
X - the resulting type of applying the functionleftJoiner - the function to apply if this is a Leftpublic abstract <X> Either<L,X> joinRight(Function<R,Either<L,X>> rightJoiner)
X - the resulting type of applying the functionrightJoiner - the function to apply if this is a Rightpublic static <L,R> Either<L,R> left(L value)
L - the type of the left side of the resulting Left[L,R]R - the type of the right side of the resulting Left[L,R]value - the value for the left sidepublic static <L,R> Either<L,R> right(R value)
L - the type of the left side of the resulting Right[L,R]R - the type of the right side of the resulting Right[L,R]value - the value for the right sideCopyright © 2014–2015. All rights reserved.