util
Class Pair<A,B>
java.lang.Object
util.Pair<A,B>
- Type Parameters:
A
- the type of the first componentB
- the type of the second component
- Direct Known Subclasses:
- MutablePair, ObjectEdge, UnorderedPair
public class Pair<A,B>
- extends Object
An ordered pair.
Constructor Summary |
Pair(A first,
B second)
Creates an ordered pair with the specified components |
first
protected final A first
second
protected final B second
Pair
public Pair(A first,
B second)
- Creates an ordered pair with the specified components
- Parameters:
first
- the first componentsecond
- the second component
getFirst
public A getFirst()
- Returns:
- the first component of the pair
getSecond
public B getSecond()
- Returns:
- the second component of the pair
toString
public String toString()
- Overrides:
toString
in class Object
equals
public boolean equals(Object other)
- Overrides:
equals
in class Object
equals
protected final boolean equals(Object x,
Object y)
- Compares two objects for equality taking care of null references
- Parameters:
x
- an objecty
- an object
- Returns:
- returns true when
x
equals y
or if
both are null
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object