|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.aliasi.util.Pair<A,B>
public class Pair<A,B>
The Pair class represents an immutable pair of objects
of heterogeneous type. This class is useful as a return type for
functions computing more than one object.
Identity conditions are that the elements are the same.
| Constructor Summary | |
|---|---|
Pair(A a,
B b)
Construct a pair consisting of the two specified elements. |
|
| Method Summary | |
|---|---|
A |
a()
Return the first value of the pair. |
B |
b()
Return the second value of the pair. |
boolean |
equals(Object that)
Returns true if the specified object
is a pair that has objects equal to this pair's. |
int |
hashCode()
Returns the hash code of the pair. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Pair(A a,
B b)
a - First element of the pair.b - Second element of the pair.| Method Detail |
|---|
public A a()
public B b()
public boolean equals(Object that)
true if the specified object
is a pair that has objects equal to this pair's.
Warning: The generic type specifications of the objects being compared do not need to match as long as the elements match.
equals in class Objectthat - Object to compare to this pair.
true if the specified object
is a pair that has objects equal to this pair's.public int hashCode()
hashCode() = 31 * a().hashCode() + b().hashCode();
- Overrides:
hashCodein classObject
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||