|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Objectdk.brics.string.util.UnorderedPair<E>
public final class UnorderedPair<E extends Comparable<E>>
An unordered immutable pair of elements. Unordered means the pair (a,b) equals the pair (b,a). An element of a pair cannot be null.
The class implementsComparable. Pairs are compared by their smallest elements, and if
those are equal, they are compared by their maximum elements.
To work correctly, the underlying element type must implement Object.equals(java.lang.Object) and
Comparable.compareTo(T) in a consistent fashion.
| Constructor Summary | |
|---|---|
UnorderedPair(E a,
E b)
Creates an unordered pair of the specified elements. |
|
| Method Summary | |
|---|---|
int |
compareTo(UnorderedPair<E> o)
|
boolean |
equals(Object obj)
|
E |
getFirst()
Gets the smallest element of the pair (according to its Comparable implementation). |
E |
getSecond()
Gets the largest element of the pair (according to its Comparable implementation). |
int |
hashCode()
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public UnorderedPair(E a,
E b)
getFirst(), for example.
a - one element of the pair. Must not be null.b - one element of the pair. Must not be null. May be the same as a.| Method Detail |
|---|
public int compareTo(UnorderedPair<E> o)
compareTo in interface Comparable<UnorderedPair<E extends Comparable<E>>>public boolean equals(Object obj)
equals in class Objectpublic E getFirst()
Comparable implementation).
public E getSecond()
Comparable implementation).
public int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||