scratch.joshua.jung_2_0.utils
Class Pair<T>

java.lang.Object
  extended by scratch.joshua.jung_2_0.utils.Pair<T>

public final class Pair<T>
extends Object

Stores a pair of values together. Access either one by directly getting the fields. Pairs are not mutable, respect equals and may be used as indices.

Note that they do not protect from malevolent behavior: if one or another object in the tuple is mutable, then that can be changed with the usual bad effects.

Author:
scott white and Danyel Fisher

Constructor Summary
Pair(T value1, T value2)
           
 
Method Summary
 boolean equals(Object o)
           
 T getFirst()
          Returns the first constructor argument.
 T getSecond()
          Returns the second constructor argument.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

public Pair(T value1,
            T value2)
Method Detail

getFirst

public T getFirst()
Returns the first constructor argument.


getSecond

public T getSecond()
Returns the second constructor argument.


equals

public boolean equals(Object o)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()