edu.rice.cs.plt.tuple
Class IdentityPair<T1,T2>

java.lang.Object
  extended by edu.rice.cs.plt.tuple.Tuple
      extended by edu.rice.cs.plt.tuple.Pair<T1,T2>
          extended by edu.rice.cs.plt.tuple.IdentityPair<T1,T2>
All Implemented Interfaces:
java.io.Serializable

public class IdentityPair<T1,T2>
extends Pair<T1,T2>

A pair that defines equals(java.lang.Object) and Tuple.hashCode() in terms of its elements' identity (==) instead of equality (@code equals})

See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.rice.cs.plt.tuple.Pair
_first, _second
 
Constructor Summary
IdentityPair(T1 first, T2 second)
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
static
<T1,T2> Lambda2<T1,T2,Pair<T1,T2>>
factory()
          Produce a lambda that invokes the constructor
protected  int generateHashCode()
           
 IdentityPair<T2,T1> inverse()
          Invert a pair.
static
<T1,T2> IdentityPair<T1,T2>
make(T1 first, T2 second)
          Call the constructor (allows the type arguments to be inferred)
 
Methods inherited from class edu.rice.cs.plt.tuple.Pair
comparator, comparator, first, firstGetter, inverter, second, secondGetter, toString
 
Methods inherited from class edu.rice.cs.plt.tuple.Tuple
hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IdentityPair

public IdentityPair(T1 first,
                    T2 second)
Method Detail

inverse

public IdentityPair<T2,T1> inverse()
Description copied from class: Pair
Invert a pair. Subclasses should override this method to create a new pair of the same type.

Overrides:
inverse in class Pair<T1,T2>

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class Pair<T1,T2>
Returns:
true iff this is of the same class as o, and each corresponding element is identical (according to ==)

generateHashCode

protected int generateHashCode()
Overrides:
generateHashCode in class Pair<T1,T2>

make

public static <T1,T2> IdentityPair<T1,T2> make(T1 first,
                                               T2 second)
Call the constructor (allows the type arguments to be inferred)


factory

public static <T1,T2> Lambda2<T1,T2,Pair<T1,T2>> factory()
Produce a lambda that invokes the constructor