List of usage examples for org.apache.commons.io.comparator LastModifiedFileComparator compare
public int compare(Object obj1, Object obj2)
From source file:org.pitest.maven.report.ReportSourceLocator.java
private File executeLocator(File reportsDirectory, Log log) { File[] subdirectories = reportsDirectory.listFiles(TIMESTAMPED_REPORTS_FILE_FILTER); File latest = reportsDirectory; log.debug("ReportSourceLocator starting search in directory [" + reportsDirectory.getAbsolutePath() + "]"); if (subdirectories != null) { LastModifiedFileComparator c = new LastModifiedFileComparator(); for (File f : subdirectories) { log.debug("comparing directory [" + f.getAbsolutePath() + "] with the current latest directory of [" + latest.getAbsolutePath() + "]"); if (c.compare(latest, f) < 0) { latest = f;//from w w w .j ava 2 s . co m log.debug("directory [" + f.getAbsolutePath() + "] is now the latest"); } } } else { throw new PitError("could not list files in directory [" + reportsDirectory.getAbsolutePath() + "] because of an unknown I/O error"); } log.debug("ReportSourceLocator determined directory [" + latest.getAbsolutePath() + "] is the directory containing the latest pit reports"); return latest; }