Skip to content

Commit

Permalink
Update src/main/java/net/querz/nbt/tag/CompoundTag.java
Browse files Browse the repository at this point in the history
Co-authored-by: Marcono1234 <Marcono1234@users.noreply.github.com>
  • Loading branch information
urielsalis and Marcono1234 committed Apr 19, 2021
1 parent 1e73e7d commit 4021aaa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/net/querz/nbt/tag/CompoundTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ public int compareTo(CompoundTag o) {

@Override
public CompoundTag clone() {
CompoundTag copy = new CompoundTag((int) Math.ceil(getValue().size() * 1.33f));
// Choose initial capacity based on default load factor (0.75) so all entries fit in map without resizing
CompoundTag copy = new CompoundTag((int) Math.ceil(getValue().size() / 0.75f));
for (Map.Entry<String, Tag<?>> e : getValue().entrySet()) {
copy.put(e.getKey(), e.getValue().clone());
}
Expand Down

0 comments on commit 4021aaa

Please sign in to comment.