-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
None
Pre-allocation of HashSet and LinkedHashSet has similar problems as HashMap: constructors for HashSet and LinkedHashSet take a capacity argument instead of the expected number of elements. This difference is a source of errors. Even if code attempts to compute the desired capacity from the expected number of elements, the computation is surprisingly difficult to get right. (See JDK-8186958, which covers this issue for HashMap et. al.)
Methods similar to those added byJDK-8186958 should be added to cover creation of HashSet and LinkedHashSet.
Use sites include the following files:
src/java.base/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java
src/java.base/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java
Methods similar to those added by
Use sites include the following files:
src/java.base/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java
src/java.base/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java
- csr for
-
JDK-8287419 Need methods to create pre-sized HashSet and LinkedHashSet
- Closed
- relates to
-
JDK-8284975 Release Note: New Methods to Create Preallocated HashMaps and HashSets
- Resolved
-
JDK-8186958 Need method to create pre-sized HashMap
- Resolved
-
JDK-8289872 wrong wording in @param doc for HashMap.newHashMap et. al.
- Resolved
(1 links to)