RFR: 8302818: Optimize wrapper sets and immutable sets of Enums [v2]

Tingjun Yuan duke at openjdk.org
Mon Feb 20 13:32:29 UTC 2023


On Mon, 20 Feb 2023 13:16:09 GMT, liach <duke at openjdk.org> wrote:

>> Tingjun Yuan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Optimize `EnumSet.copyOf` and `Set.copyOf`
>
> src/java.base/share/classes/java/util/EnumSet.java line 186:
> 
>> 184:             } else {
>> 185:                 while (i.hasNext())
>> 186:                     result.add(i.next());
> 
> Can't we just use addAll in all cases?

I wonder why the original code didn't use `addAll`, so I didn't change it. 😂

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

PR: https://git.openjdk.org/jdk/pull/12498


More information about the core-libs-dev mailing list