Skip to content

Commit

Permalink
sort files #156
Browse files Browse the repository at this point in the history
  • Loading branch information
TatianaBurek committed Sep 18, 2023
1 parent 5998ad2 commit 4a3c9fc
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions java/edu/ucar/metviewer/scorecard/web/ScorecardServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.nio.file.Files;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Arrays;
import java.util.Comparator;
import java.util.ResourceBundle;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
Expand Down Expand Up @@ -62,12 +61,10 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) {
}

public static void sortFilesByDateCreated (File[] files) {
Arrays.sort(files, new Comparator<File>() {
public int compare (File f1, File f2) {
long l1 = getFileCreationEpoch(f1);
long l2 = getFileCreationEpoch(f2);
return Long.valueOf(l2).compareTo(l1);
}
Arrays.sort(files, (f1, f2) -> {
long l1 = getFileCreationEpoch(f1);
long l2 = getFileCreationEpoch(f2);
return Long.compare(l2, l1);
});
}
public static long getFileCreationEpoch (File file) {
Expand Down

0 comments on commit 4a3c9fc

Please sign in to comment.