Skip to content

Commit

Permalink
Ordering fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
crschnick committed Oct 21, 2024
1 parent 46cbd5e commit f8081b8
Showing 1 changed file with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<SavegameEntry<T, I>>() {
@Override
public int compare(SavegameEntry<T, I> o1, SavegameEntry<T, I> 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);

Expand Down

0 comments on commit f8081b8

Please sign in to comment.