AbstractFileComparator (Commons IO 2.5)
Date: 2016-12-01

org.apache.commons.io.comparator

## Class AbstractFileComparator

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

- All Implemented Interfaces:
    java.util.Comparator<java.io.File>
  Direct Known Subclasses:
    CompositeFileComparator, DefaultFileComparator, DirectoryFileComparator, ExtensionFileComparator, LastModifiedFileComparator, NameFileComparator, PathFileComparator, ReverseComparator, SizeFileComparator

      abstract class AbstractFileComparator
      extends java.lang.Object
      implements java.util.Comparator<java.io.File>

  Abstract file `Comparator` which provides sorting for file arrays and lists.
  Since:
    2.0
  Version:
    $Id: AbstractFileComparator.java 1415850 2012-11-30 20:51:39Z ggregory $

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractFileComparator()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.io.File[]` | `sort(java.io.File... files)` Sort an array of files.
    `java.util.List<java.io.File>` | `sort(java.util.List<java.io.File> files)` Sort a List of files.
    `java.lang.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, equals`

- - ### Constructor Detail

    - #### AbstractFileComparator

          AbstractFileComparator()

  - ### Method Detail

    - #### sort

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

      Sort 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
      Since:
        2.0

    - #### sort

          public java.util.List<java.io.File> sort(java.util.List<java.io.File> files)

      Sort a List of files.

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

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

    - #### toString

          public java.lang.String toString()

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

Copyright (c) 2002-2016 Apache Software Foundation