On Thu, 24 Mar 2022 17:43:31 GMT, XenoAmess <d...@openjdk.java.net> wrote:
>> 8186958: Need method to create pre-sized HashMap > > XenoAmess has updated the pull request incrementally with two additional > commits since the last revision: > > - update jmh > - refine javadoc; refine implement when expectedSize < 0 This is a very nice addition. In Elasticsearch we have such API points, which are tedious to get right and test. src/java.base/share/classes/java/util/HashMap.java line 2584: > 2582: > 2583: /** > 2584: * Creates a new, empty HashMap with an initial table size You probably wanna allow for a non-NEW instance for the corner case where the given size is 0 - no elements. ------------- PR: https://git.openjdk.java.net/jdk/pull/7928