@Test public void testCompareDateDirDesc() { Arrays.sort(files, new FileComparator(FileComparator.DATE_CRITERION, false, true, AbstractFile::getName)); assert D.equals(files[0]); assert B.equals(files[1]); assert C.equals(files[2]); assert A.equals(files[3]); }
public boolean equals(Object o) { if(! (o instanceof FileComparator)) return false; FileComparator fc = (FileComparator)o; return criterion ==fc.criterion && ascending==fc.ascending; }
FileComparator implements Comparator<AbstractFile> { public boolean equals(Object o) { if(! (o instanceof FileComparator)) return false; FileComparator fc = (FileComparator)o; return criterion ==fc.criterion && ascending==fc.ascending; } }
FileComparator implements Comparator<AbstractFile> { public boolean equals(Object o) { if(! (o instanceof FileComparator)) return false; FileComparator fc = (FileComparator)o; return criterion ==fc.criterion && ascending==fc.ascending; } FileComparator(int criterion, boolean ascending, boolean directoriesFirst, Function<AbstractFile, String> nameFunc); }
FileComparator implements Comparator<AbstractFile> { public boolean equals(Object o) { if(! (o instanceof FileComparator)) return false; FileComparator fc = (FileComparator)o; return criterion ==fc.criterion && ascending==fc.ascending; } FileComparator(int criterion, boolean ascending, boolean directoriesFirst, Function<AbstractFile, String> nameFunc); int compare(AbstractFile f1, AbstractFile f2); boolean equals(Object o); }
FileComparator implements Comparator<AbstractFile> { public boolean equals(Object o) { if(! (o instanceof FileComparator)) return false; FileComparator fc = (FileComparator)o; return criterion ==fc.criterion && ascending==fc.ascending; } FileComparator(int criterion, boolean ascending, boolean directoriesFirst, Function<AbstractFile, String> nameFunc); int compare(AbstractFile f1, AbstractFile f2); boolean equals(Object o); final static int NAME_CRITERION; final static int SIZE_CRITERION; final static int DATE_CRITERION; final static int EXTENSION_CRITERION; final static int PERMISSIONS_CRITERION; final static int OWNER_CRITERION; final static int GROUP_CRITERION; }