Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8184694

add lexicographic comparator methods for collections

    Details

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

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated: