| Modifier and Type | Class and Description |
|---|---|
static class |
Pair.Instance<S2>
The
CartesianLike type class instance for Pair. |
static class |
Pair.Mu<S>
The witness type for
Pair. |
| Constructor and Description |
|---|
Pair(F first,
S second)
Constructs a pair with the given values.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
F |
getFirst()
The first value.
|
S |
getSecond()
The second value.
|
int |
hashCode() |
<F2> (F2,S) |
mapFirst((? super F) -> ? extends F2 function)
Transforms the first element of this pair to another type.
|
<S2> (F,S2) |
mapSecond((? super S) -> ? extends S2 function)
Transforms the second element of this pair to another type.
|
static <F,S> (F,S) |
of(F first,
S second)
Creates a pair with the given values.
|
(S,F) |
swap()
Returns a pair with the elements of this pair swapped.
|
static <F,S> Collector<(F,S),?,Map<F,S>> |
toMap()
|
String |
toString() |
static <F,S> (F,S) |
unbox((F,S) box)
|
public Pair(F first, S second)
first - The first value.second - The second value.of(Object, Object)public static <F,S> (F,S) unbox((F,S) box)
F - The type of the first value.S - The type of the second value.box - The boxed pair.public F getFirst()
public S getSecond()
public <F2> (F2,S) mapFirst((? super F) -> ? extends F2 function)
Pair.F2 - The new type of the first element.function - The transformation.Pair.Instance.map(Function, App)public <S2> (F,S2) mapSecond((? super S) -> ? extends S2 function)
Pair.S2 - The new type of the second element.function - The transformation.public static <F,S> (F,S) of(F first, S second)
F - The type of the first value.S - The type of the second value.first - The first value.second - The second value.