public class Pair<A,B>
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
equals(java.lang.Object)
, hashCode()
,
toString()
, and/or clone()
behavior matter to you at all, you
may not want to use this (or you may at least wish to subclass).
This class may be used with the Google Web Toolkit (GWT).
Modifier and Type | Field and Description |
---|---|
A |
first
The first element of the pair.
|
B |
second
The second element of the pair.
|
Constructor and Description |
---|
Pair(A first,
B second)
Cumbersome way to create a new pair (see
of(A, B) . |
Modifier and Type | Method and Description |
---|---|
Pair<A,B> |
clone() |
boolean |
equals(java.lang.Object object) |
A |
getFirst()
Optional accessor method for
first . |
B |
getSecond()
Optional accessor method for
second . |
int |
hashCode() |
static <A,B> Pair<A,B> |
of(A first,
B second)
Creates a new pair containing the given objects in order.
|
java.lang.String |
toString()
This implementation returns the String representation of this pair in
the form
(string1, string2) , where string1 and
string2 are the Object.toString() representations of the
elements inside the pair. |
public final A first
public final B second
public static <A,B> Pair<A,B> of(A first, B second)
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
(string1, string2)
, where string1
and
string2
are the Object.toString()
representations of the
elements inside the pair.toString
in class java.lang.Object