From 990c7a631e4820f91621402ae5e51e3a4094f00c Mon Sep 17 00:00:00 2001 From: iProdigy Date: Thu, 17 Oct 2024 11:17:09 -0700 Subject: [PATCH] refactor: reduce memory usage of drops map --- src/main/java/dinkplugin/util/AbstractRarityService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/dinkplugin/util/AbstractRarityService.java b/src/main/java/dinkplugin/util/AbstractRarityService.java index f361df2d..af38afdf 100644 --- a/src/main/java/dinkplugin/util/AbstractRarityService.java +++ b/src/main/java/dinkplugin/util/AbstractRarityService.java @@ -41,10 +41,11 @@ public abstract class AbstractRarityService { } raw.forEach((sourceName, rawDrops) -> { - List drops = rawDrops.stream() + ArrayList drops = rawDrops.stream() .map(RawDrop::transform) .flatMap(Collection::stream) - .collect(Collectors.toList()); + .collect(Collectors.toCollection(ArrayList::new)); + drops.trimToSize(); dropsBySourceName.put(sourceName, drops); }); }