F - type of first valueS - type of second valuepublic abstract class Either<F,S> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Either.First<F,S>
Container that only has the first value.
|
static class |
Either.Second<F,S>
Container that only has the second value.
|
| Modifier and Type | Method and Description |
|---|---|
static <F,S> Either<F,S> |
first(F val)
Creates an new Either instance with the first value.
|
abstract F |
getFirst()
Retrieve the first value.
|
abstract S |
getSecond()
Retrieve the second value.
|
abstract boolean |
hasFirst()
Checks if this container has the first value.
|
abstract boolean |
hasSecond()
Checks if this container has the second value.
|
static <F,S> Either<F,S> |
second(S val)
Creates an new Either instance with the second value.
|
public static <F,S> Either<F,S> first(F val)
F - Type of the first value.S - Type of the second value.val - The first value.public static <F,S> Either<F,S> second(S val)
F - Type of the first value.S - Type of the second value.val - The second value.public abstract boolean hasFirst()
true if this is the first value.public abstract boolean hasSecond()
true if this is the second value.public abstract F getFirst()
IllegalStateException - if this instance has no first value.public abstract S getSecond()
IllegalStateException - if this instance has no second value.Copyright © 2018. All rights reserved.