On Wed, 4 May 2022 14:57:19 GMT, Jaikiran Pai <j...@openjdk.org> wrote:

>> Stuart Marks has updated the pull request incrementally with two additional 
>> commits since the last revision:
>>  - Assertions over return values. Some refinement of equals() testing.
>>  - Add comment about Map.Entry identity not guaranteed.
> test/jdk/java/util/IdentityHashMap/Basic.java line 500:
>> 498:         Box newKey = new Box(k1a);
>> 499:         Box newVal = new Box(v1a);
>> 500:         Box r = map.computeIfAbsent(newKey, k -> { called[0] = true; 
>> return newVal; });
> More of a curiosity than a review comment - I see that various places in this 
> PR use a boolean array with one element instead of just a boolean type. Is 
> that a personal coding preference or is there something more to it?

This just serves as a modifiable boolean like an AtomicBoolean. Remember 
lambdas can only use final local var references (due to how they work), and it 
cannot access or modify the local variable in the caller method.


PR: https://git.openjdk.java.net/jdk/pull/8354

Reply via email to