L
- Left typeR
- Right typepublic final class Either<L,R> extends Object
Modifier and Type | Method | Description |
---|---|---|
void |
apply(Consumer<? super L> lFunc,
Consumer<? super R> rFunc) |
Apply the consumers to the left or the right value depending on which is present.
|
static <L,R> Either<L,R> |
left(L value) |
Create a new Either with the left type.
|
<T> T |
map(Function<? super L,? extends T> lFunc,
Function<? super R,? extends T> rFunc) |
Maps the Either to a type and returns the resolved value (which may be from the left or the right value).
|
<T> Either<T,R> |
mapLeft(Function<? super L,? extends T> lFunc) |
Map the left most value and return a new Either reflecting the new types.
|
<T> Either<L,T> |
mapRight(Function<? super R,? extends T> rFunc) |
Map the right most value and return a new Either reflecting the new types.
|
static <L,R> Either<L,R> |
right(R value) |
Create a new Either with the right type.
|
public <T> T map(Function<? super L,? extends T> lFunc, Function<? super R,? extends T> rFunc)
T
- Type that both the left and right should be mapped to.lFunc
- Function that maps the left value if present.rFunc
- Function that maps the right value if present.public <T> Either<T,R> mapLeft(Function<? super L,? extends T> lFunc)
T
- New type of left value.lFunc
- Function that maps the left value if present.public <T> Either<L,T> mapRight(Function<? super R,? extends T> rFunc)
T
- New type of right value.rFunc
- Function that maps the right value if present.public void apply(Consumer<? super L> lFunc, Consumer<? super R> rFunc)
lFunc
- Consumer of left value, invoked if left value is present.rFunc
- Consumer of right value, invoked if right value is present.public static <L,R> Either<L,R> left(L value)
L
- Left typeR
- Right typevalue
- Left valuepublic static <L,R> Either<L,R> right(R value)
L
- Left typeR
- Right typevalue
- Right valueCopyright © 2017 Amazon Web Services, Inc. All Rights Reserved.