Skip to content

Commit 9f137b1

Browse files
committed
Use foreach instead of stream api to load heads faster
1 parent 6510838 commit 9f137b1

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/main/java/de/kcodeyt/headsdb/database/Database.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,9 @@ private ScheduledFuture<Boolean> load(boolean clear) {
8686
try(final InputStream inputStream = connection.getInputStream();
8787
final Reader reader = new InputStreamReader(inputStream)) {
8888
final List<Map<String, String>> values = GSON.<List<Map<String, String>>>fromJson(reader, List.class);
89-
final List<HeadEntry> headEntries = values.stream().
90-
map(map -> new HeadEntry(map.get("name"), map.get("uuid"), map.get("value"), map.get("tags"))).
91-
sorted(Comparator.comparing(HeadEntry::getName)).
92-
collect(Collectors.toList());
89+
final List<HeadEntry> headEntries = new ArrayList<>();
90+
for(Map<String, String> map : values)
91+
headEntries.add(new HeadEntry(map.get("name"), map.get("uuid"), map.get("value"), map.get("tags")));
9392
localHeadEntries.addAll(headEntries);
9493
localCategories.add(new Category(category, category.getDisplayName(), Iterables.getLast(headEntries).getTexture(), Collections.unmodifiableList(headEntries)));
9594
}

0 commit comments

Comments
 (0)