|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object se.chalmers.cs.gf.util.Pair<A,B>
A
- The type of the first value.B
- The type of the second value.public class Pair<A,B>
An immutable 2-tuple. Based on code from Higher-Order Java.
Field Summary | |
---|---|
A |
fst
The first component. |
B |
snd
The second component. |
Constructor Summary | |
---|---|
Pair(A fst,
B snd)
Creates a new pair. |
Method Summary | ||
---|---|---|
int |
compareTo(Pair<A,B> p)
FIXME: Fails if the element types are not comparable. |
|
boolean |
equals(java.lang.Object o)
Compares this pair to another object for equality. |
|
int |
hashCode()
Returns a hash code for this pair. |
|
static
|
pair(A a,
B b)
Construct a pair. |
|
java.lang.Object[] |
toArray()
Gets an array representation of this pair. |
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final A fst
public final B snd
Constructor Detail |
---|
public Pair(A fst, B snd)
fst
- The first component.snd
- The second component.Method Detail |
---|
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- The object to compare this pair with.
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(Pair<A,B> p)
compareTo
in interface java.lang.Comparable<Pair<A,B>>
public java.lang.Object[] toArray()
public static <A,B> Pair<A,B> pair(A a, B b)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |