public final class Comparators
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static com.gs.collections.api.block.SerializableComparator<java.util.Collection<?>> |
ascendingCollectionSizeComparator() |
static <T> com.gs.collections.api.block.SerializableComparator<T> |
byBooleanFunction(com.gs.collections.api.block.function.primitive.BooleanFunction<T> function) |
static <T> com.gs.collections.api.block.SerializableComparator<T> |
byByteFunction(com.gs.collections.api.block.function.primitive.ByteFunction<T> function) |
static <T> com.gs.collections.api.block.SerializableComparator<T> |
byCharFunction(com.gs.collections.api.block.function.primitive.CharFunction<T> function) |
static <T> com.gs.collections.api.block.SerializableComparator<T> |
byDoubleFunction(com.gs.collections.api.block.function.primitive.DoubleFunction<T> function) |
static <T> com.gs.collections.api.block.SerializableComparator<com.gs.collections.api.tuple.Pair<T,?>> |
byFirstOfPair(java.util.Comparator<? super T> comparator)
Creates a comparator for pairs by using an existing comparator that only compares the first element of the pair
|
static <T> com.gs.collections.api.block.SerializableComparator<T> |
byFloatFunction(com.gs.collections.api.block.function.primitive.FloatFunction<T> function) |
static <T,V extends java.lang.Comparable<? super V>> |
byFunction(com.gs.collections.api.block.function.Function<? super T,? extends V> function) |
static <T,V> com.gs.collections.api.block.SerializableComparator<T> |
byFunction(com.gs.collections.api.block.function.Function<? super T,? extends V> function,
java.util.Comparator<V> comparator) |
static <T> com.gs.collections.api.block.SerializableComparator<T> |
byIntFunction(com.gs.collections.api.block.function.primitive.IntFunction<T> function) |
static <T> com.gs.collections.api.block.SerializableComparator<T> |
byLongFunction(com.gs.collections.api.block.function.primitive.LongFunction<T> function) |
static <T> com.gs.collections.api.block.SerializableComparator<com.gs.collections.api.tuple.Pair<?,T>> |
bySecondOfPair(java.util.Comparator<? super T> comparator)
Creates a comparator for pairs by using an existing comparator that only compares the second element of the pair
|
static <T> com.gs.collections.api.block.SerializableComparator<T> |
byShortFunction(com.gs.collections.api.block.function.primitive.ShortFunction<T> function) |
static <T> com.gs.collections.api.block.SerializableComparator<T> |
chain(java.util.Comparator<T>... comparators) |
static com.gs.collections.api.block.SerializableComparator<java.util.Collection<?>> |
descendingCollectionSizeComparator() |
static <T,V extends java.lang.Comparable<? super V>> |
fromFunctions(com.gs.collections.api.block.function.Function<? super T,? extends V> one) |
static <T,V1 extends java.lang.Comparable<? super V1>,V2 extends java.lang.Comparable<? super V2>> |
fromFunctions(com.gs.collections.api.block.function.Function<? super T,? extends V1> one,
com.gs.collections.api.block.function.Function<? super T,? extends V2> two) |
static <T,V1 extends java.lang.Comparable<? super V1>,V2 extends java.lang.Comparable<? super V2>,V3 extends java.lang.Comparable<? super V3>> |
fromFunctions(com.gs.collections.api.block.function.Function<? super T,? extends V1> one,
com.gs.collections.api.block.function.Function<? super T,? extends V2> two,
com.gs.collections.api.block.function.Function<? super T,? extends V3> three) |
static <T> com.gs.collections.api.block.SerializableComparator<T> |
naturalOrder()
Uses the natural compareTo methods of the objects which will throw if there are any nulls.
|
static <T extends java.lang.Comparable<T>> |
nullSafeCompare(T value1,
T value2) |
static boolean |
nullSafeEquals(java.lang.Object value1,
java.lang.Object value2) |
static <T> com.gs.collections.api.block.SerializableComparator<com.gs.collections.api.set.sorted.SortedSetIterable<T>> |
powerSet() |
static <T> com.gs.collections.api.block.SerializableComparator<T> |
reverse(java.util.Comparator<T> comparator) |
static <T> com.gs.collections.api.block.SerializableComparator<T> |
reverseNaturalOrder()
Uses the natural compareTo methods of the objects which will throw if there are any nulls.
|
static <T> com.gs.collections.api.block.SerializableComparator<T> |
safeNullsHigh(java.util.Comparator<T> notNullSafeComparator) |
static <T> com.gs.collections.api.block.SerializableComparator<T> |
safeNullsLow(java.util.Comparator<T> notNullSafeComparator) |
public static <T> com.gs.collections.api.block.SerializableComparator<T> naturalOrder()
public static <T> com.gs.collections.api.block.SerializableComparator<T> reverseNaturalOrder()
public static <T> com.gs.collections.api.block.SerializableComparator<T> reverse(java.util.Comparator<T> comparator)
comparator - original comparator whose order will be reversedpublic static <T> com.gs.collections.api.block.SerializableComparator<T> safeNullsLow(java.util.Comparator<T> notNullSafeComparator)
public static <T> com.gs.collections.api.block.SerializableComparator<T> safeNullsHigh(java.util.Comparator<T> notNullSafeComparator)
public static <T> com.gs.collections.api.block.SerializableComparator<T> chain(java.util.Comparator<T>... comparators)
public static <T,V extends java.lang.Comparable<? super V>> com.gs.collections.api.block.SerializableComparator<T> fromFunctions(com.gs.collections.api.block.function.Function<? super T,? extends V> one)
public static <T,V1 extends java.lang.Comparable<? super V1>,V2 extends java.lang.Comparable<? super V2>> com.gs.collections.api.block.SerializableComparator<T> fromFunctions(com.gs.collections.api.block.function.Function<? super T,? extends V1> one,
com.gs.collections.api.block.function.Function<? super T,? extends V2> two)
public static <T,V1 extends java.lang.Comparable<? super V1>,V2 extends java.lang.Comparable<? super V2>,V3 extends java.lang.Comparable<? super V3>> com.gs.collections.api.block.SerializableComparator<T> fromFunctions(com.gs.collections.api.block.function.Function<? super T,? extends V1> one,
com.gs.collections.api.block.function.Function<? super T,? extends V2> two,
com.gs.collections.api.block.function.Function<? super T,? extends V3> three)
public static <T> com.gs.collections.api.block.SerializableComparator<com.gs.collections.api.set.sorted.SortedSetIterable<T>> powerSet()
public static com.gs.collections.api.block.SerializableComparator<java.util.Collection<?>> ascendingCollectionSizeComparator()
public static com.gs.collections.api.block.SerializableComparator<java.util.Collection<?>> descendingCollectionSizeComparator()
public static <T> com.gs.collections.api.block.SerializableComparator<com.gs.collections.api.tuple.Pair<T,?>> byFirstOfPair(java.util.Comparator<? super T> comparator)
comparator - original comparator that compares the first element of the pairpublic static <T> com.gs.collections.api.block.SerializableComparator<com.gs.collections.api.tuple.Pair<?,T>> bySecondOfPair(java.util.Comparator<? super T> comparator)
comparator - original comparator that compares the second element of the pairpublic static <T,V extends java.lang.Comparable<? super V>> com.gs.collections.api.block.SerializableComparator<T> byFunction(com.gs.collections.api.block.function.Function<? super T,? extends V> function)
public static <T> com.gs.collections.api.block.SerializableComparator<T> byBooleanFunction(com.gs.collections.api.block.function.primitive.BooleanFunction<T> function)
public static <T> com.gs.collections.api.block.SerializableComparator<T> byByteFunction(com.gs.collections.api.block.function.primitive.ByteFunction<T> function)
public static <T> com.gs.collections.api.block.SerializableComparator<T> byCharFunction(com.gs.collections.api.block.function.primitive.CharFunction<T> function)
public static <T> com.gs.collections.api.block.SerializableComparator<T> byDoubleFunction(com.gs.collections.api.block.function.primitive.DoubleFunction<T> function)
public static <T> com.gs.collections.api.block.SerializableComparator<T> byFloatFunction(com.gs.collections.api.block.function.primitive.FloatFunction<T> function)
public static <T> com.gs.collections.api.block.SerializableComparator<T> byIntFunction(com.gs.collections.api.block.function.primitive.IntFunction<T> function)
public static <T> com.gs.collections.api.block.SerializableComparator<T> byLongFunction(com.gs.collections.api.block.function.primitive.LongFunction<T> function)
public static <T> com.gs.collections.api.block.SerializableComparator<T> byShortFunction(com.gs.collections.api.block.function.primitive.ShortFunction<T> function)
public static <T,V> com.gs.collections.api.block.SerializableComparator<T> byFunction(com.gs.collections.api.block.function.Function<? super T,? extends V> function,
java.util.Comparator<V> comparator)
public static boolean nullSafeEquals(java.lang.Object value1,
java.lang.Object value2)
public static <T extends java.lang.Comparable<T>> int nullSafeCompare(T value1,
T value2)