| Package | Description |
|---|---|
| java.lang | |
| java.util |
| Modifier and Type | Field and Description |
|---|---|
static Comparator<String> |
String.CASE_INSENSITIVE_ORDER
A Comparator that orders
String objects as by
compareToIgnoreCase. |
| Modifier and Type | Method and Description |
|---|---|
static <T,U extends Comparable<? super U>> |
Comparator.comparing(Function<? super T,? extends U> keyExtractor)
Accepts a function that extracts a
Comparable sort key from a type T, and returns a Comparator<T> that compares by that sort key. |
static <T,U> Comparator<T> |
Comparator.comparing(Function<? super T,? extends U> keyExtractor,
Comparator<? super U> keyComparator)
Accepts a function that extracts a sort key from a type
T, and
returns a Comparator<T> that compares by that sort key using
the specified Comparator. |
static <K extends Comparable<? super K>,V> |
Map.Entry.comparingByKey()
Returns a comparator that compares
Map.Entry in natural order on key. |
static <K,V> Comparator<Map.Entry<K,V>> |
Map.Entry.comparingByKey(Comparator<? super K> cmp)
Returns a comparator that compares
Map.Entry by key using the given
Comparator. |
static <K,V extends Comparable<? super V>> |
Map.Entry.comparingByValue()
Returns a comparator that compares
Map.Entry in natural order on value. |
static <K,V> Comparator<Map.Entry<K,V>> |
Map.Entry.comparingByValue(Comparator<? super V> cmp)
Returns a comparator that compares
Map.Entry by value using the given
Comparator. |
static <T> Comparator<T> |
Comparator.comparingDouble(ToDoubleFunction<? super T> keyExtractor)
Accepts a function that extracts a
double sort key from a type
T, and returns a Comparator<T> that compares by that
sort key. |
static <T> Comparator<T> |
Comparator.comparingInt(ToIntFunction<? super T> keyExtractor)
Accepts a function that extracts an
int sort key from a type
T, and returns a Comparator<T> that compares by that
sort key. |
static <T> Comparator<T> |
Comparator.comparingLong(ToLongFunction<? super T> keyExtractor)
Accepts a function that extracts a
long sort key from a type
T, and returns a Comparator<T> that compares by that
sort key. |
static <T extends Comparable<? super T>> |
Comparator.naturalOrder()
Returns a comparator that compares
Comparable objects in natural
order. |
static <T> Comparator<T> |
Comparator.nullsFirst(Comparator<? super T> comparator)
Returns a null-friendly comparator that considers
null to be
less than non-null. |
static <T> Comparator<T> |
Comparator.nullsLast(Comparator<? super T> comparator)
Returns a null-friendly comparator that considers
null to be
greater than non-null. |
default Comparator<T> |
Comparator.reversed()
Returns a comparator that imposes the reverse ordering of this
comparator.
|
static <T extends Comparable<? super T>> |
Comparator.reverseOrder()
Returns a comparator that imposes the reverse of the natural
ordering.
|
default Comparator<T> |
Comparator.thenComparing(Comparator<? super T> other)
Returns a lexicographic-order comparator with another comparator.
|
default <U extends Comparable<? super U>> |
Comparator.thenComparing(Function<? super T,? extends U> keyExtractor)
Returns a lexicographic-order comparator with a function that
extracts a
Comparable sort key. |
default <U> Comparator<T> |
Comparator.thenComparing(Function<? super T,? extends U> keyExtractor,
Comparator<? super U> keyComparator)
Returns a lexicographic-order comparator with a function that
extracts a key to be compared with the given
Comparator. |
default Comparator<T> |
Comparator.thenComparingDouble(ToDoubleFunction<? super T> keyExtractor)
Returns a lexicographic-order comparator with a function that
extracts a
double sort key. |
default Comparator<T> |
Comparator.thenComparingInt(ToIntFunction<? super T> keyExtractor)
Returns a lexicographic-order comparator with a function that
extracts a
int sort key. |
default Comparator<T> |
Comparator.thenComparingLong(ToLongFunction<? super T> keyExtractor)
Returns a lexicographic-order comparator with a function that
extracts a
long sort key. |
| Modifier and Type | Method and Description |
|---|---|
static <T> int |
Objects.compare(T a,
T b,
Comparator<? super T> c)
Returns 0 if the arguments are identical and
c.compare(a, b) otherwise. |
static <T,U> Comparator<T> |
Comparator.comparing(Function<? super T,? extends U> keyExtractor,
Comparator<? super U> keyComparator)
Accepts a function that extracts a sort key from a type
T, and
returns a Comparator<T> that compares by that sort key using
the specified Comparator. |
static <K,V> Comparator<Map.Entry<K,V>> |
Map.Entry.comparingByKey(Comparator<? super K> cmp)
Returns a comparator that compares
Map.Entry by key using the given
Comparator. |
static <K,V> Comparator<Map.Entry<K,V>> |
Map.Entry.comparingByValue(Comparator<? super V> cmp)
Returns a comparator that compares
Map.Entry by value using the given
Comparator. |
static <T> Comparator<T> |
Comparator.nullsFirst(Comparator<? super T> comparator)
Returns a null-friendly comparator that considers
null to be
less than non-null. |
static <T> Comparator<T> |
Comparator.nullsLast(Comparator<? super T> comparator)
Returns a null-friendly comparator that considers
null to be
greater than non-null. |
default void |
List.sort(Comparator<? super E> c)
Sorts this list according to the order induced by the specified
Comparator. |
default Comparator<T> |
Comparator.thenComparing(Comparator<? super T> other)
Returns a lexicographic-order comparator with another comparator.
|
default <U> Comparator<T> |
Comparator.thenComparing(Function<? super T,? extends U> keyExtractor,
Comparator<? super U> keyComparator)
Returns a lexicographic-order comparator with a function that
extracts a key to be compared with the given
Comparator. |
Copyright © 2025 API Design. All Rights Reserved.