|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.io.comparator.DefaultFileComparator
public class DefaultFileComparator
Compare two files using the default File.compareTo(File)
method.
This comparator can be used to sort lists or arrays of files by using the default file comparison.
Example of sorting a list of files using the
DEFAULT_COMPARATOR
singleton instance:
List<File> list = ... Collections.sort(list, DefaultFileComparator.DEFAULT_COMPARATOR);
Example of doing a reverse sort of an array of files using the
DEFAULT_REVERSE
singleton instance:
File[] array = ... Arrays.sort(array, DefaultFileComparator.DEFAULT_REVERSE);
Field Summary | |
---|---|
static Comparator |
DEFAULT_COMPARATOR
Singleton default comparator instance |
static Comparator |
DEFAULT_REVERSE
Singleton reverse default comparator instance |
Constructor Summary | |
---|---|
DefaultFileComparator()
|
Method Summary | |
---|---|
int |
compare(Object obj1,
Object obj2)
Compare the two files using the File.compareTo(File) method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Field Detail |
---|
public static final Comparator DEFAULT_COMPARATOR
public static final Comparator DEFAULT_REVERSE
Constructor Detail |
---|
public DefaultFileComparator()
Method Detail |
---|
public int compare(Object obj1, Object obj2)
File.compareTo(File)
method.
compare
in interface Comparator
obj1
- The first file to compareobj2
- The second file to compare
File.compareTo(File)
with file2 as the parameter.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |