Skip to content

Commit

Permalink
feat(context): Reuse EmptyContext instance on deflation
Browse files Browse the repository at this point in the history
  • Loading branch information
PerfectSlayer committed Dec 30, 2024
1 parent 001b500 commit fb5152d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public <V> Context with(ContextKey<V> secondKey, @Nullable V secondValue) {
int secondIndex = secondKey.index;
if (this.index == secondIndex) {
return secondValue == null
? new EmptyContext()
? EmptyContext.INSTANCE
: new SingletonContext(this.index, secondValue);
} else {
Object[] store = new Object[max(this.index, secondIndex) + 1];
Expand Down

0 comments on commit fb5152d

Please sign in to comment.