public static final class ArraysMDE.ComparableArrayComparatorLengthFirst<T extends java.lang.Comparable<T>>
extends java.lang.Object
implements java.util.Comparator<T[]>, java.io.Serializable
Note: this comparator imposes orderings that are inconsistent with Object.equals(java.lang.Object)
.
That is, it may return 0 if the arrays contain identical objects but are not equal according to
equals()
.
Constructor and Description |
---|
ComparableArrayComparatorLengthFirst() |
Modifier and Type | Method and Description |
---|---|
int |
compare(T[] a1,
T[] a2)
Compare two arrays by length, then lexically (element-by-element).
|
public ComparableArrayComparatorLengthFirst()
public int compare(T[] a1, T[] a2)
compare
in interface java.util.Comparator<T extends java.lang.Comparable<T>[]>
a1
- first array to comparea2
- second array to compare