|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.plt.tuple.Tuple
edu.rice.cs.plt.tuple.Pair<T1,T2>
public class Pair<T1,T2>
An arbitrary pair of objects; overrides toString(), equals(Object),
and Tuple.hashCode().
| Field Summary | |
|---|---|
protected T1 |
_first
|
protected T2 |
_second
|
| Constructor Summary | |
|---|---|
Pair(T1 first,
T2 second)
|
|
| Method Summary | ||
|---|---|---|
static
|
comparator()
Produce a comparator for pairs, ordered by the natural order of the elements (the leftmost elements have the highest sort priority). |
|
static
|
comparator(Comparator<? super T1> comp1,
Comparator<? super T2> comp2)
Produce a comparator for pairs, ordered by the given comparators (the leftmost elements have the highest sort priority). |
|
boolean |
equals(Object o)
|
|
static
|
factory()
Produce a lambda that invokes the constructor. |
|
T1 |
first()
|
|
static
|
firstGetter()
Produce a lambda that invokes first() on a provided pair. |
|
protected int |
generateHashCode()
|
|
Pair<T2,T1> |
inverse()
Invert a pair. |
|
static
|
inverter()
Produce a lambda that invokes inverse() on a provided pair. |
|
static
|
make(T1 first,
T2 second)
Call the constructor (allows the type arguments to be inferred) |
|
T2 |
second()
|
|
static
|
secondGetter()
Produce a lambda that invokes second() on a provided pair. |
|
String |
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 |
| Field Detail |
|---|
protected final T1 _first
protected final T2 _second
| Constructor Detail |
|---|
public Pair(T1 first,
T2 second)
| Method Detail |
|---|
public T1 first()
public T2 second()
public Pair<T2,T1> inverse()
public String toString()
toString in class Objectpublic boolean equals(Object o)
equals in class Objecttrue iff this is of the same class as o, and each
corresponding element is equal (according to equals)protected int generateHashCode()
generateHashCode in class Tuple
public static <T1,T2> Pair<T1,T2> make(T1 first,
T2 second)
public static <T1,T2> Lambda2<T1,T2,Pair<T1,T2>> factory()
public static <T1,T2> Lambda<Pair<T1,T2>,Pair<T2,T1>> inverter()
inverse() on a provided pair.
public static <T> Lambda<Pair<? extends T,?>,T> firstGetter()
first() on a provided pair.
public static <T> Lambda<Pair<?,? extends T>,T> secondGetter()
second() on a provided pair.
public static <T1 extends Comparable<? super T1>,T2 extends Comparable<? super T2>> TotalOrder<Pair<? extends T1,? extends T2>> comparator()
public static <T1,T2> TotalOrder<Pair<? extends T1,? extends T2>> comparator(Comparator<? super T1> comp1,
Comparator<? super T2> comp2)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||