|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.ens_cachan.dptinfo.util.Pair<F,S>
public class Pair<F extends java.lang.Comparable<? super F>,S extends java.lang.Comparable<? super S>>
A generic implementation of a pair of elements. Pairs are restricted
to hold Comparable
elements.
Comparable
Constructor Summary | |
---|---|
Pair(F f,
S s)
Creates a new pair. |
Method Summary | |
---|---|
int |
compareTo(Pair<F,S> o)
Compares this pair with the specified pair for order, using the order on the first element, and the order on the second element in case of equality on the first one. |
boolean |
equals(java.lang.Object obj)
Indicates whether this Pair is equivalent to the
passed Object . |
F |
getFirst()
Return the first element in this pair. |
S |
getSecond()
Return the second element in this pair. |
int |
hashCode()
Return a hash code value for this pair. |
void |
setFirst(F f)
Sets the first element in this pair. |
void |
setSecond(S s)
Sets the second element in this pair. |
java.lang.String |
toString()
Return a String representation of this pair. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Pair(F f, S s)
f
- the first element of the pair.s
- the second element of the pair.Method Detail |
---|
public boolean equals(java.lang.Object obj)
Pair
is equivalent to the
passed Object
.
equals
in class java.lang.Object
obj
- an Object
to be tested for equivalence.
true
if and only if obj
is a
Pair
and both its first and second elements
are equivalent to this pair's first and second elements.public int compareTo(Pair<F,S> o)
compareTo
in interface java.lang.Comparable<Pair<F extends java.lang.Comparable<? super F>,S extends java.lang.Comparable<? super S>>>
o
- another Pair
with comparable types.
o
.public F getFirst()
fst
public S getSecond()
snd
public int hashCode()
java.util.Hashtable
.
hashCode
in class java.lang.Object
public void setFirst(F f)
f
- the new value for the first element.public void setSecond(S s)
s
- the new value for the second element.public java.lang.String toString()
String
representation of this pair.
toString
in class java.lang.Object
String
representations of the two
elements between angle brackets.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |