Package repast.simphony.util.collections
Class Pair<X,Y>
java.lang.Object
repast.simphony.util.collections.Pair<X,Y>
- Direct Known Subclasses:
SimpleWrapper
A simple pair class that represents a tuple with two elements.
This class is not implemented to handle null pair values, however it will
accept them.
- Version:
- $Revision: 1.1 $ $Date: 2005/12/21 22:25:35 $
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares this pair to another object.getFirst()
Retrieves the first element in the tuple (first, second).Retrieves the second element in the tuple (first, second).int
hashCode()
Returns a hashCode of this objects first and second elements xor'd.void
Sets the first element in the tuple (first, second).void
Sets the second element in the tuple (first, second).
-
Constructor Details
-
Pair
Constructs this class with the specified first and second values- Parameters:
first
- the first valuesecond
- the second value
-
-
Method Details
-
equals
Compares this pair to another object. -
hashCode
public int hashCode()Returns a hashCode of this objects first and second elements xor'd. -
getFirst
Retrieves the first element in the tuple (first, second).- Returns:
- the first element
-
getSecond
Retrieves the second element in the tuple (first, second).- Returns:
- the second element
-
setFirst
Sets the first element in the tuple (first, second).- Parameters:
first
- the first element
-
setSecond
Sets the second element in the tuple (first, second).- Parameters:
second
- the second element
-