From 4a3c9fc3c13140f0a7aaafce52296024b3bb1763 Mon Sep 17 00:00:00 2001 From: TatianaBurek Date: Mon, 18 Sep 2023 08:36:45 -0600 Subject: [PATCH] sort files #156 --- .../metviewer/scorecard/web/ScorecardServlet.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/java/edu/ucar/metviewer/scorecard/web/ScorecardServlet.java b/java/edu/ucar/metviewer/scorecard/web/ScorecardServlet.java index ebfc676e..aff5635b 100644 --- a/java/edu/ucar/metviewer/scorecard/web/ScorecardServlet.java +++ b/java/edu/ucar/metviewer/scorecard/web/ScorecardServlet.java @@ -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; @@ -62,12 +61,10 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) { } public static void sortFilesByDateCreated (File[] files) { - Arrays.sort(files, new Comparator() { - 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) {