public class FileModDateComparator
extends java.lang.Object
implements java.util.Comparator
Modifier and Type | Field and Description |
---|---|
static int |
NEWEST_FIRST
Sort by newest first.
|
static int |
OLDEST_FIRST
Sort by oldest first.
|
Constructor and Description |
---|
FileModDateComparator()
Default constructor that sorts by newest first.
|
FileModDateComparator(int sortOrder)
Constructor that allows setting the sort order by newest or oldest first.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(java.lang.Object o1,
java.lang.Object o2)
Compares two Files for sorting by their modification date.
|
public static final int NEWEST_FIRST
public static final int OLDEST_FIRST
public FileModDateComparator(int sortOrder)
sortOrder
- The order for sorting (NEWEST_FIRST or OLDEST_FIRST)NEWEST_FIRST
,
OLDEST_FIRST
public FileModDateComparator()
public int compare(java.lang.Object o1, java.lang.Object o2)
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
compare
in interface java.util.Comparator
o1
- The first Object.o2
- The second Object.