Added list initial capacity

This commit is contained in:
Felix Cravic 2020-08-14 15:15:16 +02:00
parent 94279e2dbf
commit 0dd454985f

View File

@ -61,8 +61,11 @@ public class PerGroupChunkProvider extends ThreadProvider {
return;
}
// The size of the final list, used as the initial capacity
final int size = neighboursGroups.stream().mapToInt(value -> value.size()).sum() + 1;
// Represent the merged group of all the neighbours
LongSet finalGroup = new LongArraySet();
LongSet finalGroup = new LongArraySet(size);
// Add the newly loaded chunk to the group
final long chunkIndex = ChunkUtils.getChunkIndex(chunkX, chunkZ);