From f8081b81cf9167dbee30d9634bc7029bbed29827 Mon Sep 17 00:00:00 2001 From: Christopher Schnick Date: Mon, 21 Oct 2024 12:22:06 +0200 Subject: [PATCH] Ordering fixes --- .../pdxu/app/core/SavegameManagerState.java | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/pdxu-app/src/main/java/com/crschnick/pdxu/app/core/SavegameManagerState.java b/pdxu-app/src/main/java/com/crschnick/pdxu/app/core/SavegameManagerState.java index bb79d4a0..61729e94 100644 --- a/pdxu-app/src/main/java/com/crschnick/pdxu/app/core/SavegameManagerState.java +++ b/pdxu-app/src/main/java/com/crschnick/pdxu/app/core/SavegameManagerState.java @@ -180,21 +180,25 @@ private void updateShownEntries() { newEntries.remove(entry); } }); - newEntries.sort((o1, o2) -> { - var date = o1.compareTo(o2); - if (date != 0) { - return date; - } + newEntries.sort(new Comparator>() { + @Override + public int compare(SavegameEntry o1, SavegameEntry o2) { + var date = o1.getDate().compareTo(o2.getDate()); + if (date != 0) { + return date; + } - try { - var mod = Files.getLastModifiedTime(SavegameStorage.get(current()).getSavegameFile(o1)) - .compareTo(Files.getLastModifiedTime(SavegameStorage.get(current()).getSavegameFile(o2))); - return mod; - } catch (IOException e) { - ErrorHandler.handleException(e); - return 0; + try { + var mod = Files.getLastModifiedTime(SavegameStorage.get(SavegameManagerState.this.current()).getSavegameFile(o1)) + .compareTo( + Files.getLastModifiedTime(SavegameStorage.get(SavegameManagerState.this.current()).getSavegameFile(o2))); + return mod; + } catch (IOException e) { + ErrorHandler.handleException(e); + return 0; + } } - }); + }.reversed()); shownEntries.set(newEntries);