F
- Type of the first elementS
- Type of the second elementpublic final class Pair<F,S>
extends java.lang.Object
Note that in reality, as for all containers, instances of this class are only immutable if their contained objects are also immutable.
Constructor and Description |
---|
Pair(F first,
S second)
Constructor for a pair of items.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
F |
getFirst()
Retrieve the first element from this pair.
|
S |
getSecond()
Retrieve the second element from this pair.
|
int |
hashCode() |
static <A,B> Pair<A,B> |
of(A first,
B second)
Create a pair from the specified arguments.
|
java.lang.String |
toString() |
public Pair(F first, S second)
Please consider using the factory method of(Object, Object)
instead of this constructor.
first
- The first element of the pair.second
- The second element of the pair.public static <A,B> Pair<A,B> of(A first, B second)
first
- The first element of the pair.second
- The second element of the pair.Pair
containing first
and second
.public F getFirst()
public S getSecond()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object