On Tue, 21 Feb 2023 03:39:46 GMT, Tingjun Yuan <[email protected]> wrote:
>> Currently, the two subclasses of `java.util.EnumSet` optimize bulk
>> operations when the argument is also a `EnumSet`, but there is no such
>> optimization for wrapper sets (returned by `Collections.unmodifiableSet`,
>> `Collections.synchronizedSet`, etc.) and immutable sets (returned by
>> `Set.of` methods) of `Enum`s.
>>
>> This PR introduces optimization classes for these situations. No public
>> APIs are changed.
>
> Tingjun Yuan has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Set.copyOf: need defensive copy
I have deleted `{Regular,Jumbo}EnumSetCompatible` interfaces and introduced
some package-private methods in `AbstractCollection`. This avoids rarely-used
checks from static factories in `Collections` and does not reduce much
performance compared against the previous implementation.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/12498#issuecomment-1478790594