|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.javelot.functionalj.tuple.Pair
Used to create a tuple of two objects. Tuples can be used anywhere
there is a need to group objects together, and are used by the
Tuples.zip(List,List) method.
| Constructor Summary | |
Pair(Object p_first,
Object p_second)
Creates a tuple of the two given objects. |
|
| Method Summary | |
boolean |
equals(Object p_object)
Determines if the given object is equal to this object, by comparing the two objects of each tuple using their respective equals(Object)
methods. |
Object |
getFirst()
Returns the first object of the tuple. |
Object |
getSecond()
Returns the second object of the tuple. |
protected List |
getStrings()
Returns a list of the String representations of the objects of the tuple. |
int |
hashCode()
Returns the hash code associated with this object. |
String |
toString()
Returns a String representation of the Pair. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Pair(Object p_first,
Object p_second)
p_first - the first object of the pair. A null value is
accepted.p_second - the second object of the pair. A null value is
accepted.| Method Detail |
public Object getFirst()
null.public Object getSecond()
null.public int hashCode()
Thanks to Paul Field for suggesting the improvement on this hash function.
31 each time. A null value is
considered to have* a hash code of 0. Thus, if this pair contains
two null values, this method returns 0.public boolean equals(Object p_object)
equals(Object)
methods. Corresponding null values are also considered equal.
p_object - the object against which to compare this tuple.
true if the pairs contain the same values;
false otherwise.protected List getStrings()
toString() method uses this to construct the String representation of the
tuple.
public String toString()
"(String, String)".
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||