Java 8 RFR 8024331: j.u.Map.computeIfPresent() default/nondefault implementations don't throw NPE if the remappingFunction is null and the key is absent
Remi Forax
forax at univ-mlv.fr
Tue Sep 17 22:00:14 UTC 2013
On 09/17/2013 11:33 PM, Mike Duigou wrote:
> The Map/Defaults.java changes only test HashMap. It should probably be extended to test most/all of the other implementations.
>
> I have some worry that the superfluous assignment of the Objects.requireNonNull() result might have a non-negligible cost.
apart from
foo(Object.requireNonNull(var))
or
this.var = Objects.requireNonNull(var) in a constructor,
I think that
Object.requireNonNull(var);
is more readable than
var = Object.requireNonNull(var);
Also for HashMap, I think it's better to not use Object.requireNonNull
as the current code does otherwise we need to re-run all perf benchs we
have.
>
> Mike
Rémi
>
> On Sep 17 2013, at 13:49 , Brian Burkhalter wrote:
>
>> Please review this proposed patch at your convenience.
>>
>> Summary: Explicitly check for null remappingFunction parameter (and clean up similar code for consistency).
>> Issue: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8024331
>> Webrev: http://cr.openjdk.java.net/~bpb/8024331/
>>
>> Thanks,
>>
>> Brian
More information about the core-libs-dev
mailing list