aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util
diff options
context:
space:
mode:
authorTimeConqueror <timeconqueror999@gmail.com>2021-08-16 02:34:35 +0300
committerTimeConqueror <timeconqueror999@gmail.com>2021-08-16 02:34:35 +0300
commitb05f1651f62eb87823f4ed9fe5143931b48150d9 (patch)
treeef7b3128a02da20088549ff03b69f859ddea179d /src/main/java/gregtech/api/util
parentdaa13f1cf8e5e0af0b6e4e92d1889ef9f642b0aa (diff)
downloadGT5-Unofficial-b05f1651f62eb87823f4ed9fe5143931b48150d9.tar.gz
GT5-Unofficial-b05f1651f62eb87823f4ed9fe5143931b48150d9.tar.bz2
GT5-Unofficial-b05f1651f62eb87823f4ed9fe5143931b48150d9.zip
Removed useless concurrency for some maps
Diffstat (limited to 'src/main/java/gregtech/api/util')
-rw-r--r--src/main/java/gregtech/api/util/GT_Utility.java12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java
index 17606b85a4..be5f978d6e 100644
--- a/src/main/java/gregtech/api/util/GT_Utility.java
+++ b/src/main/java/gregtech/api/util/GT_Utility.java
@@ -22,6 +22,7 @@ import gregtech.api.items.GT_EnergyArmor_Item;
import gregtech.api.items.GT_Generic_Item;
import gregtech.api.items.GT_MetaGenerated_Tool;
import gregtech.api.net.GT_Packet_Sound;
+import gregtech.api.objects.CollectorUtils;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.ItemData;
import gregtech.api.threads.GT_Runnable_Sound;
@@ -1752,15 +1753,8 @@ public class GT_Utility {
return aMap;
}
- /**
- * Why the fuck do neither Java nor Guava have a Function to do this?
- */
- public static <X, Y extends Comparable> LinkedHashMap<X, Y> sortMapByValuesAcending(Map<X, Y> aMap) {
- List<Map.Entry<X, Y>> tEntrySet = new LinkedList<>(aMap.entrySet());
- tEntrySet.sort(Entry.comparingByValue());
- LinkedHashMap<X, Y> rMap = new LinkedHashMap<>();
- for (Map.Entry<X, Y> tEntry : tEntrySet) rMap.put(tEntry.getKey(), tEntry.getValue());
- return rMap;
+ public static <X, Y extends Comparable<Y>> LinkedHashMap<X, Y> sortMapByValuesAcending(Map<X, Y> map) {
+ return map.entrySet().stream().sorted(Entry.comparingByValue()).collect(CollectorUtils.entriesToMap(LinkedHashMap::new));
}
/**