Re: RFR: 8284780: Need methods to create pre-sized HashSet and LinkedHashSet [v16]
On Fri, 27 May 2022 16:19:56 GMT, Naoto Sato wrote: >> 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 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. @naotoj done. > src/java.base/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java > line 461: > >> 459: } >> 460: StringTokenizer tokens = new >> StringTokenizer(supportedLocaleString); >> 461: Set tagset = HashSet.newHashSet(tokens.countTokens()); > > Same as above. @naotoj done. - PR: https://git.openjdk.java.net/jdk/pull/8302
Re: RFR: 8284780: Need methods to create pre-sized HashSet and LinkedHashSet [v16]
On Fri, 27 May 2022 06:14:13 GMT, XenoAmess 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 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 tagset = HashSet.newHashSet(tokens.countTokens()); Same as above. - PR: https://git.openjdk.java.net/jdk/pull/8302
Re: RFR: 8284780: Need methods to create pre-sized HashSet and LinkedHashSet [v16]
> 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. - Changes: - all: https://git.openjdk.java.net/jdk/pull/8302/files - new: https://git.openjdk.java.net/jdk/pull/8302/files/42fba932..230a767e Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk=8302=15 - incr: https://webrevs.openjdk.java.net/?repo=jdk=8302=14-15 Stats: 3 lines in 2 files changed: 0 ins; 0 del; 3 mod Patch: https://git.openjdk.java.net/jdk/pull/8302.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8302/head:pull/8302 PR: https://git.openjdk.java.net/jdk/pull/8302