O - Some object type to be compared.static class ArraysExt.ArrayComparator<O> extends Object implements Comparator<O[]>
atomic.| Modifier and Type | Field and Description |
|---|---|
private Comparator<Object> |
atomic
A
Comparator for components of an array. |
| Constructor and Description |
|---|
ArrayComparator(Comparator<Object> atomic)
Creates a new ArrayComparator
to compare two object-arrays
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(Object[] arr1,
Object[] arr2)
Describe
compare method here. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongprivate final Comparator<Object> atomic
Comparator for components of an array.
This is allocated by the constructor
#ArraysExt.ArrayComparator.ArrayComparator(Comparator<Object> atomic)
ArrayComparator
to compare two object-arrays
by lexical ordering.
Here, the orderin of the components
is defined by atomic.atomic - a Comparator for components of an array.public int compare(Object[] arr1, Object[] arr2)
compare method here.compare in interface Comparator<O[]>arr1 - an Object[] object.
The components o1[i] and o2[i]
must be pairwise comparable with respect to atomic
provided both o1[i] and o2[i] exist.arr2 - an Object[] object.
The components o1[i] and o2[i]
must be pairwise comparable with respect to atomic
provided both o1[i] and o2[i] exist.0
if and only if o1.length == o2.length
and atomic.compare(o1[i], o2[i]) == 0
for all indices i.
Hence this comparator is consistent with equals
if and only if this is true for atomic.
-1 resp.1
if o1 is a true prefix of o2
res. the other way round.
atomic.compare(o1[i], o2[i])
where i is the lowest index such that
atomic.compare(o1[i], o2[i]) != 0.
(Provided such an index in the common range exists. )
NullPointerException - if one of the arguments is null.ClassCastException - if one of the arguments is no Object[].
in particular for type int[].Copyright © 2012–2018 Simuline Organization (l2r). All rights reserved.