|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.umd.cfar.lamp.viper.util.Pair
Simple object that replicate's c++'s stl pair facility. Often useful to subclass with object specific features. Probably not included in java.util because it tends to encourage instance-heavy programming, while c++'s pair is often optimized out by the compiler.
Constructor Summary | |
Pair(java.lang.Object first,
java.lang.Object second)
Creates a new instance of Pair |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Uses first and second's .equals methods. |
java.lang.Object |
getFirst()
Returns the object passed as the first argument to the constructor. |
java.lang.Object |
getSecond()
Returns the object passed as the second argument to the constructor. |
int |
hashCode()
Gets a hashcode for the pair. |
java.lang.String |
toString()
Prints the pair as (first, second). |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Pair(java.lang.Object first, java.lang.Object second)
first
- the first element of the pairsecond
- the second element of the pairMethod Detail |
public java.lang.String toString()
public int hashCode()
first.hash ^ second.hash
, basicallypublic boolean equals(java.lang.Object obj)
obj
- the object to compare with
true
if respective elements in both Pairs are
reported as equal.public java.lang.Object getFirst()
public java.lang.Object getSecond()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |