Interface IntComparator

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 interface IntComparator
Defines an ordering of integers. This is just like Comparator but the items compared are primitive integer values rather than Objects.
Since:
3 Mar 2025
Author:
Mark Taylor
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compare(int i1, int i2)
    Compares its two arguments for order.
  • Method Details

    • compare

      int compare(int i1, int i2)
      Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is considered less than, equal to, or greater than the second.
      Parameters:
      i1 - first integer to compare
      i2 - second integer to compare
      Returns:
      a negative integer, zero, or a positive integer depending on comparison