Skip to content

Commit

Permalink
refactor: reduce memory usage of drops map
Browse files Browse the repository at this point in the history
  • Loading branch information
iProdigy committed Oct 17, 2024
1 parent 7715385 commit 990c7a6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/dinkplugin/util/AbstractRarityService.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ public abstract class AbstractRarityService {
}

raw.forEach((sourceName, rawDrops) -> {
List<RareDrop> drops = rawDrops.stream()
ArrayList<RareDrop> drops = rawDrops.stream()
.map(RawDrop::transform)
.flatMap(Collection::stream)
.collect(Collectors.toList());
.collect(Collectors.toCollection(ArrayList::new));
drops.trimToSize();
dropsBySourceName.put(sourceName, drops);
});
}
Expand Down

0 comments on commit 990c7a6

Please sign in to comment.