edu.rice.cs.plt.tuple
Class IdentityPair<T1,T2>
java.lang.Object
edu.rice.cs.plt.tuple.Tuple
edu.rice.cs.plt.tuple.Pair<T1,T2>
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
|
Method Summary |
boolean |
equals(java.lang.Object o)
|
static
|
factory()
Produce a lambda that invokes the constructor |
protected int |
generateHashCode()
|
IdentityPair<T2,T1> |
inverse()
Invert a pair. |
static
|
make(T1 first,
T2 second)
Call the constructor (allows the type arguments to be inferred) |
| 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 |
IdentityPair
public IdentityPair(T1 first,
T2 second)
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