util
Class Pair<A,B>

java.lang.Object
  extended by util.Pair<A,B>
Type Parameters:
A - the type of the first component
B - the type of the second component
Direct Known Subclasses:
MutablePair, ObjectEdge, UnorderedPair

public class Pair<A,B>
extends Object

An ordered pair.


Field Summary
protected  A first
           
protected  B second
           
 
Constructor Summary
Pair(A first, B second)
          Creates an ordered pair with the specified components
 
Method Summary
 boolean equals(Object other)
           
protected  boolean equals(Object x, Object y)
          Compares two objects for equality taking care of null references
 A getFirst()
           
 B getSecond()
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

first

protected final A first

second

protected final B second
Constructor Detail

Pair

public Pair(A first,
            B second)
Creates an ordered pair with the specified components

Parameters:
first - the first component
second - the second component
Method Detail

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 object
y - an object
Returns:
returns true when x equals y or if both are null

hashCode

public int hashCode()
Overrides:
hashCode in class Object