Package | Description |
---|---|
java.util |
Utilities
|
Modifier and Type | Method and Description |
---|---|
Comparator<? super T> |
TreeSet.comparator()
Returns this Set's comparator.
|
Comparator<? super K> |
TreeMap.comparator()
Return the comparator used to sort this map, or null if it is by
natural order.
|
Comparator<? super E> |
SortedSet.comparator()
Returns the comparator used in sorting this set, or null if it is
the elements' natural ordering.
|
Comparator<? super K> |
SortedMap.comparator()
Returns the comparator used in sorting this map, or null if it is
the keys' natural ordering.
|
Comparator<? super E> |
PriorityQueue.comparator() |
static <T> Comparator<T> |
Collections.reverseOrder()
Get a comparator that implements the reverse of natural ordering.
|
static <T> Comparator<T> |
Collections.reverseOrder(Comparator<T> c)
Get a comparator that implements the reverse of the ordering
specified by the given Comparator.
|
Modifier and Type | Method and Description |
---|---|
static <T> int |
Collections.binarySearch(List<? extends T> l,
T key,
Comparator<? super T> c)
Perform a binary search of a List for a key, using a supplied Comparator.
|
static <T> int |
Arrays.binarySearch(T[] a,
int low,
int hi,
T key,
Comparator<? super T> c)
Perform a binary search of a range of an Object array for a key using
a
Comparator . |
static <T> int |
Arrays.binarySearch(T[] a,
T key,
Comparator<? super T> c)
Perform a binary search of an Object array for a key, using a supplied
Comparator.
|
static <T> T |
Collections.max(Collection<? extends T> c,
Comparator<? super T> order)
Find the maximum element in a Collection, according to a specified
Comparator.
|
static <T> T |
Collections.min(Collection<? extends T> c,
Comparator<? super T> order)
Find the minimum element in a Collection, according to a specified
Comparator.
|
static <T> Comparator<T> |
Collections.reverseOrder(Comparator<T> c)
Get a comparator that implements the reverse of the ordering
specified by the given Comparator.
|
static <T> void |
Collections.sort(List<T> l,
Comparator<? super T> c)
Sort a list according to a specified Comparator.
|
static <T> void |
Arrays.sort(T[] a,
Comparator<? super T> c)
Sort an array of Objects according to a Comparator.
|
static <T> void |
Arrays.sort(T[] a,
int fromIndex,
int toIndex,
Comparator<? super T> c)
Sort an array of Objects according to a Comparator.
|
Constructor and Description |
---|
PriorityQueue(int cap,
Comparator<? super E> comp) |
TreeMap(Comparator<? super K> c)
Instantiate a new TreeMap with no elements, using the provided comparator
to sort.
|
TreeSet(Comparator<? super T> comparator)
Construct a new TreeSet whose backing TreeMap uses the supplied
Comparator.
|