RFR: 8186958: Need method to create pre-sized HashMap [v18]
XenoAmess
duke at openjdk.java.net
Thu Apr 14 16:58:42 UTC 2022
On Thu, 14 Apr 2022 03:38:52 GMT, Joe Wang <joehw at openjdk.org> wrote:
>>> I suspect the `size*2+1` was a failed attempt at allocating a HashMap of the correct capacity for `size` mappings.
>>
>> I looked the codes and don't think so..
>> If I'm wrong, I'm glad to fix.
>
> Stuart's right, I looked at the code, it's as you said a failed attempt, "size" would be good. So HashMap.newHashMap(size) would actually be a small improvement.
>
> It's an interesting impl the way it used HashMap, but it's 20 year code.
@JoeWang-Java @stuart-marks got it. done.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7928
More information about the nio-dev
mailing list