Package repast.simphony.util.collections
Class Pair<X,Y>
- java.lang.Object
-
- repast.simphony.util.collections.Pair<X,Y>
-
- Direct Known Subclasses:
SimpleWrapper
public class Pair<X,Y> extends Object
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 $
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Compares this pair to another object.X
getFirst()
Retrieves the first element in the tuple (first, second).Y
getSecond()
Retrieves the second element in the tuple (first, second).int
hashCode()
Returns a hashCode of this objects first and second elements xor'd.void
setFirst(X first)
Sets the first element in the tuple (first, second).void
setSecond(Y second)
Sets the second element in the tuple (first, second).
-
-
-
Method Detail
-
equals
public boolean equals(Object obj)
Compares this pair to another object.
-
hashCode
public int hashCode()
Returns a hashCode of this objects first and second elements xor'd.
-
getFirst
public X getFirst()
Retrieves the first element in the tuple (first, second).- Returns:
- the first element
-
getSecond
public Y getSecond()
Retrieves the second element in the tuple (first, second).- Returns:
- the second element
-
setFirst
public void setFirst(X first)
Sets the first element in the tuple (first, second).- Parameters:
first
- the first element
-
setSecond
public void setSecond(Y second)
Sets the second element in the tuple (first, second).- Parameters:
second
- the second element
-
-