L
- Left Object Type
R
- Right Object Type
public final class Couple<L,R> extends Object
Modifier and Type | Method and Description |
---|---|
<T> T |
apply(BiFunction<L,R,T> function)
Apply the given function to this Couple.
|
<T> T |
apply(Function<Couple<L,R>,T> function)
Apply the given function to this Couple.
|
static <L,R> Couple<L,R> |
empty()
Create a new empty Couple.
|
boolean |
equals(Object obj) |
int |
hashCode() |
boolean |
hasLeft() |
boolean |
hasRight() |
L |
left() |
static <L,R> Couple<L,R> |
leftOnly(L left)
Create a new Couple with only the left object set.
|
static <L,R> Couple<L,R> |
of(L left, R right)
Create a new Couple with both the left and right objects set.
|
R |
right() |
static <L,R> Couple<L,R> |
rightOnly(R right)
Create a new Couple with only the right object set.
|
String |
toString() |
<T> Couple<T,R> |
withLeft(T left)
Create a new Couple with this Right Object and the given Left Object.
|
<T> Couple<L,T> |
withRight(T right)
Create a new Couple with this Left Object and the given Right Object.
|
public static <L,R> Couple<L,R> empty()
L
- Left Object Type
R
- Right Object Type
public static <L,R> Couple<L,R> leftOnly(L left)
L
- Left Object Type
R
- Right Object Type
left
- Left Object
public static <L,R> Couple<L,R> rightOnly(R right)
L
- Left Object Type
R
- Right Object Type
right
- Right Object
public static <L,R> Couple<L,R> of(L left, R right)
L
- Left Object Type
R
- Right Object Type
left
- Left Object
right
- Right Object
public L left()
public R right()
public boolean hasLeft()
public boolean hasRight()
public <T> Couple<T,R> withLeft(T left)
T
- Left Object Type
left
- Left Object
public <T> Couple<L,T> withRight(T right)
T
- Right Object Type
right
- Right Object
public <T> T apply(Function<Couple<L,R>,T> function)
T
- Function Return Type
function
- Function to apply
public <T> T apply(BiFunction<L,R,T> function)
T
- Function Return Type
function
- Function to apply