|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectComparators
public final class Comparators
General purpose comparators.
modules/library/metadata (gt-metadata.jar)
Method Summary | ||
---|---|---|
static
|
forCollections()
Returns a comparator for arbitrary collections of comparable elements. |
|
static
|
forLists()
Returns a comparator for lists of comparable elements. |
|
static
|
forSortedSets()
Returns a comparator for sorted sets of comparable elements. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T extends Comparable<T>> Comparator<List<T>> forLists()
If both lists have the same length and equal elements in the sense of
Comparable.compareTo(T)
, then the comparator returns 0.
T
- The type of elements in both lists.
public static <T extends Comparable<T>> Comparator<SortedSet<T>> forSortedSets()
T
- The type of elements in both sets.
public static <T extends Comparable<T>> Comparator<Collection<T>> forCollections()
TreeSet
, LinkedHashSet
or queues.
Do not use it with HashSet
.
T
- The type of elements in both collections.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |