Skip to content

Commit

Permalink
Fix hashed reference lists being created unnecessarily
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt authored Apr 9, 2024
1 parent 84f3999 commit 7dc257e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class PoolMixin<E extends Weighted> {
@Inject(method = "<init>(Ljava/util/List;)V", at = @At("RETURN"))
private void init(List<? extends E> entries, CallbackInfo ci) {
//We are using reference equality here, because all vanilla implementations of Weighted use reference equality
this.entryHashList = this.entries.size() > 4 ? this.entries : Collections.unmodifiableList(new HashedReferenceList<>(this.entries));
this.entryHashList = this.entries.size() < 4 ? this.entries : Collections.unmodifiableList(new HashedReferenceList<>(this.entries));
}

/**
Expand Down

0 comments on commit 7dc257e

Please sign in to comment.