aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java
index e6c4dc74..828e50b1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java
@@ -160,7 +160,7 @@ public class TrophyRewardOverlay {
texts.add("Trophy Fish Exchange");
texts.add("Magma Fish: §e" + total);
- for (Map.Entry<String, Integer> entry : sortByValue(totalExchange).entrySet()) {
+ for (Map.Entry<String, Integer> entry : sortByValueReverse(totalExchange).entrySet()) {
String name = entry.getKey();
int amount = totalAmount.get(name);
String[] split = name.split(" ");
@@ -206,6 +206,19 @@ public class TrophyRewardOverlay {
public static <K, V extends Comparable<? super V>> Map<K, V> sortByValue(Map<K, V> map) {
List<Map.Entry<K, V>> list = new ArrayList<>(map.entrySet());
list.sort(Map.Entry.comparingByValue());
+
+ Map<K, V> result = new LinkedHashMap<>();
+ for (Map.Entry<K, V> entry : list) {
+ result.put(entry.getKey(), entry.getValue());
+ }
+
+ return result;
+ }
+
+ //TODO move into utils class maybe?
+ public static <K, V extends Comparable<? super V>> Map<K, V> sortByValueReverse(Map<K, V> map) {
+ List<Map.Entry<K, V>> list = new ArrayList<>(map.entrySet());
+ list.sort(Map.Entry.comparingByValue());
Collections.reverse(list);
Map<K, V> result = new LinkedHashMap<>();