| Modifier and Type | Field and Description |
|---|---|
T1 |
first
Direct access is deprecated.
|
T2 |
second
Direct access is deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Pair<T1,T2> another)
Compares this
Pair to another object. |
boolean |
equals(java.lang.Object o) |
T1 |
first() |
int |
hashCode() |
static <X,Y> Pair<X,Y> |
makePair(X x,
Y y)
Returns a Pair constructed from X and Y.
|
void |
save(java.io.DataOutputStream out)
Write a string representation of a Pair to a DataStream.
|
T2 |
second() |
void |
setFirst(T1 o) |
void |
setSecond(T2 o) |
java.lang.String |
toString() |
public T1 first
public T2 second
public T1 first()
public T2 second()
public void setFirst(T1 o)
public void setSecond(T2 o)
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic static <X,Y> Pair<X,Y> makePair(X x, Y y)
public void save(java.io.DataOutputStream out)
toString() method is called on each of the pair
of objects and a String representation is written.
This might not allow one to recover the pair of objects unless they
are of type String.public int compareTo(Pair<T1,T2> another)
Pair to another object.
If the object is a Pair, this function will work providing
the elements of the Pair are themselves comparable.
It will then return a value based on the pair of objects, where
p > q iff p.first() > q.first() ||
(p.first().equals(q.first()) && p.second() > q.second()).
If the other object is not a Pair, it throws a
ClassCastException.compareTo in interface java.lang.Comparable<Pair<T1,T2>>another - the Object to be compared.0 if the argument is a
Pair equal to this Pair; a value less than
0 if the argument is a Pair
greater than this Pair; and a value
greater than 0 if the argument is a
Pair less than this Pair.java.lang.ClassCastException - if the argument is not a
Pair.Comparable