From e84dcefb058977c2ac5652b2da54573c130b0f9a Mon Sep 17 00:00:00 2001 From: Sotr Date: Sat, 25 Jan 2020 02:15:29 +0700 Subject: [PATCH] Optimize matches holy Former-commit-id: 1f75107d587c9895fb4b9362f858d8d1b6fdc578 --- src/main/java/org/maxgamer/quickshop/Util/Util.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/Util/Util.java b/src/main/java/org/maxgamer/quickshop/Util/Util.java index a09910cfa..7ccebd79b 100644 --- a/src/main/java/org/maxgamer/quickshop/Util/Util.java +++ b/src/main/java/org/maxgamer/quickshop/Util/Util.java @@ -20,6 +20,7 @@ package org.maxgamer.quickshop.Util; import com.google.common.base.Strings; +import com.google.common.collect.Sets; import com.google.common.io.Files; import com.palmergames.bukkit.towny.event.NewDayEvent; import java.io.ByteArrayOutputStream; @@ -1113,7 +1114,7 @@ public class Util { * @return Map1 match Map2 */ public static boolean mapMatches(@NotNull Map map1, @NotNull Map map2) { - return map1.entrySet().stream().allMatch(e -> map2.get((Object) e.getKey()).equals(e.getValue())); + return map2.entrySet().containsAll(map1.entrySet()); } /** @@ -1124,12 +1125,7 @@ public class Util { * @return Map1 match Map2 */ public static boolean listMatches(@NotNull List list1, @NotNull List list2) { - for (Object obj : list1) { - if (!list2.contains(obj)) { - return false; - } - } - return true; + return list2.containsAll(list1); } /**