E - the type to be compared.private static class Comparators.AsListed<E> extends Object implements Comparator<E>, Serializable
seq.
Elements not in the list are all minimal
and pairwise equal with respect to this comparator.
They are less than all elements in the list.
The ordering on the list is ascending.
CAUTION: This ordering is consistent with equals only
if the elements of seq are pairwise non-equal.
If this condition is hurt,
an element a may satisfy a>a.
Even if this condition is satisfied,
two elements a, b not in seq
satisfy a=b with respect to the ordering
even if they are not equal
with respect to the method Object.equals(Object).
Thus the ordering is consistent with equals only,
if restricted to the elements of seq
plus one single object not in seq.
This suffices to make the method Set.add(Object)
to work properly.
The ordering is always total,
i.e. either a\le b or b\le a holds.
This is clear if both elements are in seq
and also if one is not.
Also the ordering is always transitive:
Assume a\le b or b\le c.
If a\not\in seq, then a\le c.
If b\not\in seq then also a\not\in seq.
Ifc\not\in seq then also b\not\in seq.
So, if one of the elements is not in seq,
transitivity holds.
Otherwise, all elements are in seq
and transitivity follows directly.
| Modifier and Type | Field and Description |
|---|---|
private List<E> |
seq |
private static long |
serialVersionUID |
| Modifier and Type | Method and Description |
|---|---|
int |
compare(E obj1,
E obj2) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongprivate static final long serialVersionUID
public int compare(E obj1, E obj2)
compare in interface Comparator<E>Copyright © 2012–2018 Simuline Organization (l2r). All rights reserved.