Comparator
objects.
Most of the functionality in this class can also be found in the
comparators package. This class merely provides a
convenient central place if you have use for more than one class
in the comparators subpackage.
| Modifier and Type | Field and Description |
|---|---|
| public static final Comparator | NATURAL_COMPARATOR
Comparator for natural sort order. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Comparator | Returns: a comparator that sorts booleansGets a Comparator that can sort Boolean objects. |
| public static < the object type to compare E> Comparator | Returns: aComparatorChain formed from the input comparatorsthe comparators to use, not null or empty or containing nulls comparators)Gets a comparator that compares using an array of |
| public static < the object type to compare E> Comparator | Returns: aComparatorChain formed from the input comparatorsthe comparators to use, not null or empty or containing nulls comparators)Gets a comparator that compares using a collection of |
| public static < the object type to compare E> E | Returns: the larger of the two objectsthe first object to compare o1, final E the second object to compare o2, Comparator<E> the sort order to use comparator)Returns the larger of the given objects according to the given comparator, returning the second object if the comparator returns equal. |
| public static < the object type to compare E> E | Returns: the smaller of the two objectsthe first object to compare o1, final E the second object to compare o2, Comparator<E> the sort order to use comparator)Returns the smaller of the given objects according to the given comparator, returning the second object if the comparator returns equal. |
| public static < the object type to compare E extends Comparable | Returns: a comparator which uses natural orderGets a comparator that uses the natural order of the objects. |
| public static < the object type to compare E> Comparator | Returns: a version of that comparator that allows nullsthe comparator that wants to allow nulls comparator)Gets a Comparator that controls the comparison of |
| public static < the object type to compare E> Comparator | Returns: a version of that comparator that allows nullsthe comparator that wants to allow nulls comparator)Gets a Comparator that controls the comparison of |
| public static < the object type to compare E> Comparator | Returns: a comparator that reverses the order of the input comparatorthe comparator to reverse comparator)Gets a comparator that reverses the order of the given comparator. |
| public static < the input object type of the transformed comparator I, the object type of the decorated comparator O> Comparator | Returns: a comparator that transforms its input objects before comparing themthe sort order to use comparator, final Transformer<? super I, ? extends O> the transformer to use transformer)Gets a Comparator that passes transformed objects to the given comparator. |
| NATURAL_COMPARATOR | back to summary |
|---|---|
| public static final Comparator<T> NATURAL_COMPARATOR Comparator for natural sort order.
| |
| ComparatorUtils | back to summary |
|---|---|
| private ComparatorUtils() ComparatorUtils should not normally be instantiated. | |
| booleanComparator | back to summary |
|---|---|
| public static Comparator Gets a Comparator that can sort Boolean objects. The parameter specifies whether true or false is sorted first. The comparator throws NullPointerException if a null value is compared.
| |
| chainedComparator | back to summary |
|---|---|
| public static <E> Comparator Gets a comparator that compares using an array of
| |
| chainedComparator | back to summary |
|---|---|
| public static <E> Comparator Gets a comparator that compares using a collection of
| |
| max | back to summary |
|---|---|
| public static <E> E max(final E o1, final E o2, Comparator<E> comparator) Returns the larger of the given objects according to the given comparator, returning the second object if the comparator returns equal.
| |
| min | back to summary |
|---|---|
| public static <E> E min(final E o1, final E o2, Comparator<E> comparator) Returns the smaller of the given objects according to the given comparator, returning the second object if the comparator returns equal.
| |
| naturalComparator | back to summary |
|---|---|
| public static <E extends Comparable Gets a comparator that uses the natural order of the objects.
| |
| nullHighComparator | back to summary |
|---|---|
| public static <E> Comparator Gets a Comparator that controls the comparison of The returned comparator will consider a null value to be greater than any nonnull value, and equal to any other null value. Two nonnull values will be evaluated with the given comparator.
| |
| nullLowComparator | back to summary |
|---|---|
| public static <E> Comparator Gets a Comparator that controls the comparison of The returned comparator will consider a null value to be less than any nonnull value, and equal to any other null value. Two nonnull values will be evaluated with the given comparator.
| |
| reversedComparator | back to summary |
|---|---|
| public static <E> Comparator Gets a comparator that reverses the order of the given comparator.
| |
| transformedComparator | back to summary |
|---|---|
| public static <I, O> Comparator Gets a Comparator that passes transformed objects to the given comparator. Objects passed to the returned comparator will first be transformed by the given transformer before they are compared by the given comparator.
| |