RFR: 8221924: get(null) on single-entry unmodifiable Map returns null instead of throwing NPE

Stuart Marks stuart.marks at oracle.com
Fri Apr 5 16:30:47 UTC 2019



On 4/5/19 12:04 AM, Peter Levart wrote:
> Map1.get() should be much faster with this patch too, right?

Heh. I suspect it is faster, since it no longer needs to create and entryset and 
the iterator over the entryset.

Claes and I have been chatting a lot about micro-optimizations in this area, as 
you can see, and while he stumbled over this behavioral problem, neither of us 
thought to benchmark it. I guess, if it's incorrect, the performance doesn't matter.

Fortunately in this case the result is both more consistent and faster, so we 
don't have to confront the "how much do we want to pay for correctness" tradeoff.

s'marks


More information about the core-libs-dev mailing list