Package org.apache.commons.io.function

# Interface IOComparator<T>

Type Parameters:
  `T` - the type of objects that may be compared by this comparator.

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 IOComparator<T>
Like `Comparator` but throws `IOException`.

Since:
  2.12.0
See Also:
  - `Comparator`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default Comparator<T>`
  `asComparator()`
  Creates a `Comparator` for this instance that throws `UncheckedIOException` instead of `IOException`.
  `int`
  `compare(T o1, T o2)`
  Like `Comparator.compare(Object, Object)` but throws `IOException`.

- ## Method Details

  - ### asComparator

    default Comparator<T> asComparator()
    Creates a `Comparator` for this instance that throws `UncheckedIOException` instead of `IOException`.
    Returns:
      an UncheckedIOException BiFunction.

  - ### compare

    int compare(T o1, T o2) throws IOException
    Like `Comparator.compare(Object, Object)` but throws `IOException`.
    Parameters:
      `o1` - the first object to be compared.
      `o2` - the second object to be compared.
    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.
      `ClassCastException` - if the arguments' types prevent them from being compared by this comparator.
      `IOException` - if an I/O error occurs.