On Wed, 23 Mar 2022 18:41:59 GMT, XenoAmess <d...@openjdk.java.net> wrote:

> 8186958: Need method to create pre-sized HashMap

src/java.base/share/classes/java/util/Collections.java line 5826:

> 5824:      * @since 19
> 5825:      */
> 5826:     public static <K, V> HashMap<K, V> newHashMap(int expectedSize) {

Stuart [in a JBS 
comment](https://bugs.openjdk.java.net/browse/JDK-8186958?focusedCommentId=14483078&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-14483078)
 recommends keeping these factories to the respective classes instead of 
`Collections`. In existing code, such factories stay in the respective classes, 
including `ConcurrentHashMap.newKeySet(int)`.

Since this is an API change, I suggest you determine where the methods will 
stay before filing a CSR request.

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

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

Reply via email to