RFR: 8186958: Need method to create pre-sized HashMap [v10]

Stuart Marks smarks at openjdk.java.net
Wed Apr 6 02:41:35 UTC 2022


On Sat, 2 Apr 2022 22:46:19 GMT, XenoAmess <duke at openjdk.java.net> wrote:

>> 8186958: Need method to create pre-sized HashMap
>
> XenoAmess has updated the pull request incrementally with one additional commit since the last revision:
> 
>   revert changes in jdk.compile

src/java.base/share/classes/java/util/HashMap.java line 2556:

> 2554:      */
> 2555:     static int calculateHashMapCapacity(int numMappings) {
> 2556:         return (int) Math.ceil(numMappings / 0.75);

Please use `(double) DEFAULT_LOAD_FACTOR` instead of `0.75`.

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

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


More information about the core-libs-dev mailing list