public final class Comparators extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T extends Comparable<T>> |
forCollections()
Returns a comparator for arbitrary collections of comparable elements.
|
static <T extends Comparable<T>> |
forLists()
Returns a comparator for lists of comparable elements.
|
static <T extends Comparable<T>> |
forSortedSets()
Returns a comparator for sorted sets of comparable elements.
|
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.Copyright © 1996–2019 Geotools. All rights reserved.