add lexicographic comparator methods for collections

XMLWordPrintable

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

      There should be methods that compare two collections lexicographically, something like this on the Collections class:

      public static <T> int compare(Collection<? extends T> c1,
                                        Collection<? extends T> c2,
                                        Comparator<? super T> cmp)

      public static <T extends Comparable<? super T>>
          int compare(Collection<? extends T> c1, Collection<? extends T> c2)

      Of course, the collections must have a well-defined iteration order, such as List, LinkedHashSet, or SortedSet.

      Update 2023-10-23: the arguments could be SequencedCollection to ensure encounter order is well-defined.

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

              Created:
              Updated: