On Wed, 4 May 2022 15:02:43 GMT, liach <d...@openjdk.java.net> wrote:
>> 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. Thank you @liach and Stuart. I had overlooked the lambda aspect of this. ------------- PR: https://git.openjdk.java.net/jdk/pull/8354