lv.gotika.engine.util
Class Pair<A,B>

java.lang.Object
  extended by lv.gotika.engine.util.Pair<A,B>

public class Pair<A,B>
extends Object

Data structure: an ordered 2-tuple consisting of generic objects.


Constructor Summary
Pair(A first, B second)
          Standard constructor.
 
Method Summary
 boolean equals(Object o)
          Indicates whether some other object is "equal to" this one.
 A getFirst()
          Returns the first element of the pair.
 B getSecond()
          Returns the second element of the pair.
 int hashCode()
          Returns a hash code value for the pair (depends on its two elements).
 String toString()
          Returns a string representation of the pair (concatenation of its two elements).
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

public Pair(A first,
            B second)
Standard constructor.

Parameters:
first - the first element of the pair.
second - the second element of the pair.
Method Detail

getFirst

public A getFirst()
Returns the first element of the pair.

Returns:
reference to the first element.

getSecond

public B getSecond()
Returns the second element of the pair.

Returns:
reference to the second element.

toString

public String toString()
Returns a string representation of the pair (concatenation of its two elements).

Overrides:
toString in class Object
Returns:
a string representation of this object.

hashCode

public int hashCode()
Returns a hash code value for the pair (depends on its two elements).

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
See Also:
equals(Object)

equals

public boolean equals(Object o)
Indicates whether some other object is "equal to" this one. Two pairs are equal if their respective elements are equal.

Overrides:
equals in class Object
Parameters:
o - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
hashCode()