RFR: 8284780: Need methods to create pre-sized HashSet and LinkedHashSet [v16]

Naoto Sato naoto at openjdk.java.net
Fri May 27 16:26:50 UTC 2022


On Fri, 27 May 2022 06:14:13 GMT, XenoAmess <duke at openjdk.java.net> wrote:

>> as title.
>
> XenoAmess has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Merge remote-tracking branch 'stuart-marks/pull/8302' into fix_8284780
>    
>    # Conflicts:
>    #	src/java.base/share/classes/java/util/HashSet.java
>    #	src/java.base/share/classes/java/util/LinkedHashSet.java
>  - Minor terminology fixes: change "item" and "key" to element; remove
>    "insertion-ordered" from LinkedHashSet static factory method because
>    LHS is implicit insertion-ordered.

src/java.base/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java line 227:

> 225:         }
> 226:         StringTokenizer tokens = new StringTokenizer(supportedLocaleString);
> 227:         Set<String> tagset = HashSet.newHashSet(tokens.countTokens());

Hi @XenoAmess, during the refactoring of the above `StringTokenizer`, it turned out that this `HashSet` can be replaced with `Set.of()`. So you can leave this piece as it is, as I will take care of it with JDK-8287340.

src/java.base/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java line 461:

> 459:         }
> 460:         StringTokenizer tokens = new StringTokenizer(supportedLocaleString);
> 461:         Set<String> tagset = HashSet.newHashSet(tokens.countTokens());

Same as above.

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

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


More information about the core-libs-dev mailing list