-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
None
There should be static factory methods on Comparator that create Comparator instances from an explicit list of values (varargs) or from a collection of such values (which must have a defined order, of course).
There should be variations where the explicit values are ordered first, or last, or that generate an exception. For the order-first and -last variations, a downstream comparator should be provided to order any non-matching values.
public static <T> Comparator<T> explicitFirst(Comparator<? super T> comparator, T first, T... rest)
public static <T> Comparator<T> explicitLast(Comparator<? super T> comparator, T first, T... rest)
public static <T> Comparator<T> explicitFirst(Comparator<? super T> comparator, Collection<? extends T> coll)
public static <T> Comparator<T> explicitLast(Comparator<? super T> comparator, Collection<? extends T> coll)
public static <T> Comparator<T> explicit(T first, T... rest)
public static <T> Comparator<T> explicit(Collection<? extends T> coll)
There should be variations where the explicit values are ordered first, or last, or that generate an exception. For the order-first and -last variations, a downstream comparator should be provided to order any non-matching values.
public static <T> Comparator<T> explicitFirst(Comparator<? super T> comparator, T first, T... rest)
public static <T> Comparator<T> explicitLast(Comparator<? super T> comparator, T first, T... rest)
public static <T> Comparator<T> explicitFirst(Comparator<? super T> comparator, Collection<? extends T> coll)
public static <T> Comparator<T> explicitLast(Comparator<? super T> comparator, Collection<? extends T> coll)
public static <T> Comparator<T> explicit(T first, T... rest)
public static <T> Comparator<T> explicit(Collection<? extends T> coll)