public static final class ArraysMDE.ObjectArrayComparatorLengthFirst
extends java.lang.Object
implements java.util.Comparator<java.lang.Object[]>, 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()
.
Note: if toString returns a nondeterministic value, such as one that depends on the result
of hashCode()
, then this comparator may yield different orderings from run to run of a
program.
Constructor and Description |
---|
ObjectArrayComparatorLengthFirst() |
Modifier and Type | Method and Description |
---|---|
int |
compare(java.lang.Object[] a1,
java.lang.Object[] a2)
Compare two arrays by length, then lexically (element-by-element).
|
public int compare(java.lang.Object[] a1, java.lang.Object[] a2)
compare
in interface java.util.Comparator<java.lang.Object[]>
a1
- first array to comparea2
- second array to compare