public final class Comparators
extends java.lang.Object
Comparator instances| Modifier and Type | Method and Description |
|---|---|
static <T> java.util.Comparator<java.util.Optional<T>> |
emptiesFirst(java.util.Comparator<? super T> valueComparator) |
static <T> java.util.Comparator<java.util.Optional<T>> |
emptiesLast(java.util.Comparator<? super T> valueComparator) |
static <T> boolean |
isInOrder(java.lang.Iterable<? extends T> iterable,
java.util.Comparator<T> comparator) |
static <T> boolean |
isInStrictOrder(java.lang.Iterable<? extends T> iterable,
java.util.Comparator<T> comparator) |
public static <T> boolean isInOrder(java.lang.Iterable<? extends T> iterable,
java.util.Comparator<T> comparator)
T - The type being compared to determine ordering stateiterable - The ordered sequence of values to evaluate ordering oncomparator - Comparator used to determine ordering compliancetrue if each element in iterable after the first is greater than or equal to the element
that preceded it, according to the specified comparatorpublic static <T> boolean isInStrictOrder(java.lang.Iterable<? extends T> iterable,
java.util.Comparator<T> comparator)
T - The type being compared to determine ordering stateiterable - The ordered sequence of values to evaluate strict ordering oncomparator - Comparator used to determine ordering compliancetrue if each element in iterable after the first is strictly greater than the
element that preceded it, according to the specified comparator. Note that an element is not
strictly after another if they are considered equivalentpublic static <T> java.util.Comparator<java.util.Optional<T>> emptiesFirst(java.util.Comparator<? super T> valueComparator)
T - The type being comparedvalueComparator - Comparator used to order present valuesOptional values which treats Optional.empty() as less than all other
values, and orders the rest using valueComparator on the contained valuepublic static <T> java.util.Comparator<java.util.Optional<T>> emptiesLast(java.util.Comparator<? super T> valueComparator)
T - The type being comparedvalueComparator - Comparator used to order present valuesOptional values which treats Optional.empty() as greater than all other
values, and orders the rest using valueComparator on the contained value