|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinf.util.Pair<C1,C2>
C1
- the type of the first component of this pairC2
- the type of the second component of this pairpublic class Pair<C1,C2>
This class represents a typed, ordered pair of two Objects. Both components of a Pair may be null. Access to the components is provided through direct access to the public instance variables.
Field Summary | |
---|---|
C1 |
comp1
the first component of this pair |
C2 |
comp2
the second component of this pair |
Constructor Summary | |
---|---|
Pair(C1 comp1,
C2 comp2)
This constructor creates a new Pair that pairs the two given components. |
Method Summary | |
---|---|
Pair<C1,C2> |
clone()
This function creates a semi-shallow clone of this Pair. |
boolean |
equals(java.lang.Object obj)
This function tests whether this and the given Object are equal. |
boolean |
equals(Pair<C1,C2> other)
This function tests whether this and the given Pair are equal. |
int |
hashCode()
This function computes a positive hash value for this pair. |
java.lang.String |
toString()
This function returns a printable representation of this Pair. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public C1 comp1
public C2 comp2
Constructor Detail |
---|
public Pair(C1 comp1, C2 comp2)
This constructor creates a new Pair that pairs the two given components. Access to the components is provided through direct access to the public instance variables.
comp1
- the first component of this paircomp2
- the second component of this pairMethod Detail |
---|
public Pair<C1,C2> clone()
This function creates a semi-shallow clone of this Pair. The clone will
contain the same components as the original pair. The result is an equal
Pair (see equals(Pair)
), but not the same (this) Pair.
clone
in class java.lang.Object
public boolean equals(java.lang.Object obj)
This function tests whether this and the given Object are equal. They are
equal if the given Object is a Pair that is equal to this Pair. The
latter is tested using the equals(Pair)
function. The given
Object should not be null.
equals
in class java.lang.Object
obj
- the Object this should be compared to
public boolean equals(Pair<C1,C2> other)
This function tests whether this and the given Pair are equal. They are equal if both pairs contain equal components. Note that the given Pair must not be null. However, the components may both be null.
other
- the Pair this should be compared to
public int hashCode()
This function computes a positive hash value for this pair. The returned value normally is the sum of the hash values of the two components.
hashCode
in class java.lang.Object
public java.lang.String toString()
This function returns a printable representation of this Pair. The general syntax of this string is as follows: <comp1, comp2>.
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |