- Type Parameters:
T
- the array type, e.g.int[]
,double[]
orSeq<String>
- Enclosing class:
ProxySorter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
The comparator used for comparing two array elements at the specified
indexes.
The example above shows how to create a comparator for
final ProxySorter.Comparator<double[]> comparator =
(a, i, j) -> Double.compare(a[i], a[j]);
double[]
arrays.- Since:
- 5.1
- Version:
- 5.1
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionint
Compares the two array elements, specified by its indices, for order.default ProxySorter.Comparator
<T> reversed()
Returns a comparator that imposes the reverse ordering of this comparator.
-
Method Details
-
compare
Compares the two array elements, specified by its indices, for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.- Parameters:
array
- the array where the two comparing elements are fetchedi
- the index of the first array elementj
- the index of the second array element- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
- Throws:
NullPointerException
- if an argument is null and this comparator does not permit null arguments- See Also:
-
reversed
Returns a comparator that imposes the reverse ordering of this comparator.- Returns:
- a comparator that imposes the reverse ordering of this comparator.
-