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

Tingjun Yuan duke at openjdk.org
Mon Feb 20 13:43:01 UTC 2023


> 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:

  Use `addAll` in `EnumSet.copyOf`
  
  It seems to be okay to use `addAll` in all cases.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/12498/files
  - new: https://git.openjdk.org/jdk/pull/12498/files/41f4a909..098b3fff

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=12498&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=12498&range=01-02

  Stats: 6 lines in 1 file changed: 0 ins; 5 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/12498.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12498/head:pull/12498

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


More information about the core-libs-dev mailing list