Interface ProxySorter.Comparator<T>

Type Parameters:
T - the array type, e.g. int[], double[] or Seq<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.

@FunctionalInterface public static interface ProxySorter.Comparator<T>
The comparator used for comparing two array elements at the specified indexes.
final ProxySorter.Comparator<double[]> comparator = (a, i, j) -> Double.compare(a[i], a[j]);
The example above shows how to create a comparator for double[] arrays.
Since:
5.1
Version:
5.1
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compare(T array, int i, int j)
    Compares the two array elements, specified by its indices, for order.
    Returns a comparator that imposes the reverse ordering of this comparator.
  • Method Details

    • compare

      int compare(T array, int i, int j)
      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 fetched
      i - the index of the first array element
      j - 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.