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
Brian Burkhalter
brian.burkhalter at oracle.com
Tue Sep 17 23:25:52 UTC 2013
On Sep 17, 2013, at 3:00 PM, Remi Forax wrote:
> 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);
I don't feel strongly about it: it's mostly about not ignoring the return value. I don't think it's that important in this case.
> 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.
Likewise, I don't have any objection to not replacing equivalent code which is known to work.
I'll update the patch and repost.
Thanks,
Brian
More information about the core-libs-dev
mailing list