org.apache.commons.io.comparator

## Class AbstractFileComparator

- java.lang.Object
- - org.apache.commons.io.comparator.AbstractFileComparator

- All Implemented Interfaces:
    Comparator<File>
  Direct Known Subclasses:
    CompositeFileComparator, DefaultFileComparator, DirectoryFileComparator, ExtensionFileComparator, LastModifiedFileComparator, NameFileComparator, PathFileComparator, ReverseFileComparator, SizeFileComparator

      abstract class AbstractFileComparator
      extends Object
      implements Comparator<File>

  Abstract class for file `Comparator`s.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractFileComparator()` Default constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `File[]` | `sort(File... files)` Sorts an array of files.
    `List<File>` | `sort(List<File> files)` Sorts a List of files.
    `String` | `toString()` String representation of this file comparator.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.Comparator

      `compare, comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- - ### Constructor Detail

    - #### AbstractFileComparator

          protected AbstractFileComparator()

      Default constructor.

  - ### Method Detail

    - #### sort

          public File[] sort(File... files)

      Sorts an array of files.

      This method uses `Arrays.sort(Object[], Comparator)` and returns the original array.

      Parameters:
        `files` - The files to sort, may be null.
      Returns:
        The sorted array.

    - #### sort

          public List<File> sort(List<File> files)

      Sorts a List of files.

      This method uses `List.sort(Comparator)` and returns the original list.

      Parameters:
        `files` - The files to sort, may be null.
      Returns:
        The sorted list.

    - #### toString

          public String toString()

      String representation of this file comparator.
      Overrides:
        `toString` in class `Object`
      Returns:
        String representation of this file comparator.