add Comparator factory methods for explicit values

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • None
    • Affects Version/s: None
    • Component/s: core-libs

      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)

            Assignee:
            Stuart Marks
            Reporter:
            Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: