-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
None
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.
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.
- relates to
-
JDK-8194664 add Comparator.comparingArray and thenComparingArray
-
- Open
-
-
JDK-8015767 SortedSet should implement Comparable
-
- Open
-