Top Inners Fields Constructors Methods
org.eclipse.collections.impl.block.factory

public final Class Comparators

extends Object
Class Inheritance
Imports
java.util.Collection, .Comparator, java.util.function.BiPredicate, org.eclipse.collections.api.block.SerializableComparator, org.eclipse.collections.api.block.factory.SerializableComparators, org.eclipse.collections.api.block.function.Function, org.eclipse.collections.api.block.function.primitive.BooleanFunction, .ByteFunction, .CharFunction, .DoubleFunction, .FloatFunction, .IntFunction, .LongFunction, .ShortFunction, org.eclipse.collections.api.set.sorted.SortedSetIterable, org.eclipse.collections.api.tuple.Pair, org.eclipse.collections.impl.block.comparator.FunctionComparator

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final SerializableComparator<Collection<?>>
private static final SerializableComparator<?>
private static final SerializableComparator<Collection<?>>
private static final SerializableComparator<?>
private static final SerializableComparator<?>
private static final SerializableComparator<?>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static SerializableComparator<Collection<?>>
public static <T> SerializableComparator<T>
public static <T> SerializableComparator<T>
public static <T> SerializableComparator<T>
public static <T> SerializableComparator<T>
public static <T> SerializableComparator<Pair<T, ?>>

Returns:

A comparator that compares pairs only by their first element
byFirstOfPair
(Comparator<? super T>
original comparator that compares the first element of the pair
comparator
)

Creates a comparator for pairs by using an existing comparator that only compares the first element of the pair

public static <T> SerializableComparator<T>
public static <T, V extends Comparable<? super V>> SerializableComparator<T>
byFunction(Function<? super T, ? extends V> function)

public static <T, V> SerializableComparator<T>
byFunction(Function<? super T, ? extends V> function, Comparator<V> comparator)

Original signature accepted a Comparator which may not be Serializable.

public static <T, V extends Comparable<? super V>> SerializableComparator<T>
byFunctionNullsFirst(Function<? super T, ? extends V> function)

public static <T, V extends Comparable<? super V>> SerializableComparator<T>
byFunctionNullsLast(Function<? super T, ? extends V> function)

public static <T> SerializableComparator<T>
public static <T> SerializableComparator<T>
public static <T> SerializableComparator<Pair<?, T>>

Returns:

A comparator that compares pairs only by their second element
bySecondOfPair
(Comparator<? super T>
original comparator that compares the second element of the pair
comparator
)

Creates a comparator for pairs by using an existing comparator that only compares the second element of the pair

public static <T> SerializableComparator<T>
public static <T> SerializableComparator<T>
chain(Comparator<T>... comparators)

public static <T> SerializableComparator<T>
public static <T> Comparator<? super T>
comparableComparatorIfNull(Comparator<? super T> comparator)

public static SerializableComparator<Collection<?>>
public static <T, V extends Comparable<? super V>> SerializableComparator<T>
fromFunctions(Function<? super T, ? extends V> one)

public static <T, V1 extends Comparable<? super V1>, V2 extends Comparable<? super V2>> SerializableComparator<T>
fromFunctions(Function<? super T, ? extends V1> one, Function<? super T, ? extends V2> two)

public static <T, V1 extends Comparable<? super V1>, V2 extends Comparable<? super V2>, V3 extends Comparable<? super V3>> SerializableComparator<T>
fromFunctions(Function<? super T, ? extends V1> one, Function<? super T, ? extends V2> two, Function<? super T, ? extends V3> three)

public static <T> SerializableComparator<T>
fromPredicate(BiPredicate<? super T, ? super T>
a predicate that returns true if the first argument is less than, or should appear before, the second argument
isBeforePredicate
)

private static <T, V extends Comparable<? super V>> SerializableComparator<T>
getPrimitiveFunctionComparator(Function<? super T, ? extends V> function)

public static <T> SerializableComparator<T>
naturalOrder()

Uses the natural compareTo methods of the objects which will throw if there are any nulls.

public static <T extends Comparable<T>> int
nullSafeCompare(T value1, T value2)

public static boolean
nullSafeEquals(Object value1, Object value2)

public static <T, V extends Comparable<? super V>> SerializableComparator<T>
originalByFunction(Function<? super T, ? extends V> function)
Deprecated

This signature is kept for serialization backwards compatibility.

public static <T, V> SerializableComparator<T>
originalByFunction(Function<? super T, ? extends V> function, Comparator<V> comparator)
Deprecated

Original signature accepted a Comparator which may not be Serializable.

public static <T> SerializableComparator<T>
originalNaturalOrder()
Deprecated

This method exists in order to guarantee serialization compatibility in tests.

public static <T> SerializableComparator<T>
originalReverseNaturalOrder()
Deprecated

This method exists in order to guarantee serialization compatibility in tests.

public static <T> SerializableComparator<SortedSetIterable<T>>
public static <T> SerializableComparator<T>

Returns:

A comparator that reverses the order of any other Serializable Comparator.
reverse
(Comparator<T>
original comparator whose order will be reversed
comparator
)

public static <T> SerializableComparator<T>
reverseNaturalOrder()

Uses the natural compareTo methods of the objects which will throw if there are any nulls.

public static <T> SerializableComparator<T>
safeNullsHigh(Comparator<T> notNullSafeComparator)

public static <T> SerializableComparator<T>
safeNullsLow(Comparator<T> notNullSafeComparator)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait