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

liach duke at openjdk.java.net
Fri May 27 05:12:43 UTC 2022


On Thu, 26 May 2022 18:08:13 GMT, XenoAmess <duke at openjdk.java.net> wrote:

>> as title.
>
> XenoAmess has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 16 commits:
> 
>  - Merge branch 'master' of https://git.openjdk.java.net/jdk into fix_8284780
>  - Merge remote-tracking branch 'openjdk/master' into fix_8284780
>    
>    # Conflicts:
>    #	test/jdk/java/util/HashMap/WhiteBoxResizeTest.java
>  - add 8284780 to test
>  - redo the tests
>  - rename items to elements
>  - add test for newHashSet and newLinkedHashSet
>  - revert much too changes for newHashSet
>  - add more replaces
>  - add more replaces
>  - add more replaces
>  - ... and 6 more: https://git.openjdk.java.net/jdk/compare/7cb368b3...117918f4

src/java.base/share/classes/java/util/HashSet.java line 130:

> 128:      * @apiNote
> 129:      * To create a {@code HashSet} with an initial capacity that accommodates
> 130:      * an expected number of items, use {@link #newHashSet(int) newHashSet}.

Suggestion:

     * an expected number of elements, use {@link #newHashSet(int) newHashSet}.

src/java.base/share/classes/java/util/HashSet.java line 147:

> 145:      * @apiNote
> 146:      * To create a {@code HashSet} with an initial capacity that accommodates
> 147:      * an expected number of items, use {@link #newHashSet(int) newHashSet}.

Suggestion:

     * an expected number of elements, use {@link #newHashSet(int) newHashSet}.

src/java.base/share/classes/java/util/HashSet.java line 391:

> 389:      *
> 390:      * @param numElements    the expected number of elements
> 391:      * @param <E>         the type of keys maintained by this set

Suggestion:

     * @param <E> the type of elements maintained by this set

src/java.base/share/classes/java/util/LinkedHashSet.java line 131:

> 129:      * @apiNote
> 130:      * To create a {@code LinkedHashSet} with an initial capacity that accommodates
> 131:      * an expected number of items, use {@link #newLinkedHashSet(int) newLinkedHashSet}.

Suggestion:

     * an expected number of elements, use {@link #newLinkedHashSet(int) newLinkedHashSet}.

src/java.base/share/classes/java/util/LinkedHashSet.java line 148:

> 146:      * @apiNote
> 147:      * To create a {@code LinkedHashSet} with an initial capacity that accommodates
> 148:      * an expected number of items, use {@link #newLinkedHashSet(int) newLinkedHashSet}.

Suggestion:

     * an expected number of elements, use {@link #newLinkedHashSet(int) newLinkedHashSet}.

src/java.base/share/classes/java/util/LinkedHashSet.java line 212:

> 210:      *
> 211:      * @param numElements    the expected number of elements
> 212:      * @param <E>         the type of keys maintained by this set

Suggestion:

     * @param <E> the type of elements maintained by this set

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

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


More information about the core-libs-dev mailing list