Class SerializableComparators
- java.lang.Object
-
- org.eclipse.collections.api.block.factory.SerializableComparators
-
public final class SerializableComparators extends java.lang.Object
This class provides a minimal set of SerializableComparator methods for use in the API module.- Since:
- 11.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
SerializableComparators.NaturalOrderComparator<T extends java.lang.Comparable<T>>
private static class
SerializableComparators.ReverseComparator<T>
-
Field Summary
Fields Modifier and Type Field Description private static SerializableComparator<?>
NATURAL_ORDER_COMPARATOR
private static SerializableComparator<?>
REVERSE_NATURAL_ORDER_COMPARATOR
-
Constructor Summary
Constructors Modifier Constructor Description private
SerializableComparators()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T,V extends java.lang.Comparable<? super V>>
SerializableComparator<T>byFunction(Function<? super T,? extends V> function)
static <T,V>
SerializableComparator<T>byFunction(Function<? super T,? extends V> function, SerializableComparator<V> comparator)
static <T> SerializableComparator<T>
naturalOrder()
Uses the natural compareTo methods of the objects which will throw if there are any nulls.static <T> SerializableComparator<T>
reverse(SerializableComparator<T> comparator)
static <T> SerializableComparator<T>
reverseNaturalOrder()
Uses the natural compareTo methods of the objects which will throw if there are any nulls.
-
-
-
Field Detail
-
NATURAL_ORDER_COMPARATOR
private static final SerializableComparator<?> NATURAL_ORDER_COMPARATOR
-
REVERSE_NATURAL_ORDER_COMPARATOR
private static final SerializableComparator<?> REVERSE_NATURAL_ORDER_COMPARATOR
-
-
Method Detail
-
naturalOrder
public static <T> SerializableComparator<T> naturalOrder()
Uses the natural compareTo methods of the objects which will throw if there are any nulls.
-
reverseNaturalOrder
public static <T> SerializableComparator<T> reverseNaturalOrder()
Uses the natural compareTo methods of the objects which will throw if there are any nulls.
-
reverse
public static <T> SerializableComparator<T> reverse(SerializableComparator<T> comparator)
- Parameters:
comparator
- original comparator whose order will be reversed- Returns:
- A comparator that reverses the order of any other Serializable Comparator.
-
byFunction
public static <T,V extends java.lang.Comparable<? super V>> SerializableComparator<T> byFunction(Function<? super T,? extends V> function)
-
byFunction
public static <T,V> SerializableComparator<T> byFunction(Function<? super T,? extends V> function, SerializableComparator<V> comparator)
-
-