RFR: 8281631: HashMap copy constructor and putAll can over-allocate table [v32]

XenoAmess duke at openjdk.java.net
Fri Mar 11 04:17:47 UTC 2022


On Fri, 11 Mar 2022 01:42:19 GMT, XenoAmess <duke at openjdk.java.net> wrote:

>> XenoAmess has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   refine test
>
> oops seems I wronglly added a teat case 0/1
> will delete it later

> @XenoAmess I don't think we need `KeyStructure`. It's probably sufficient to change the map types to `Map<String, String>` and then use `String.valueOf(i)` to generate strings to use as keys and values. (If we did need something like `KeyStructure`, it would be a perfect use of record classes.)

Seems good.

Will do it at about 12 hours later, when I off work.

> Also, I don't think `tableSizeFor` needs quite as many cases. It's sufficient to test the edge and boundary cases.

Well I just don't think there be any cost in adding them... after all they runs fast.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7431


More information about the core-libs-dev mailing list