RFR: 8302818: Optimize wrapper sets and immutable sets of Enums

Tingjun Yuan duke at openjdk.org
Mon Feb 20 12:15:19 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.

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

Commit messages:
 - add `import` in SetFactories.java
 - Fix typo
 - Update SetFactories.java
 - make configure not executable
 - Update Collections.java
 - Revert "Merge remote-tracking branch 'origin/optimize-enum-coll' into optimize-enum-coll"
 - Merge remote-tracking branch 'origin/optimize-enum-coll' into optimize-enum-coll
 - Check for unmodifiable sets in `unmodifiableSet`
 - fix error
 - add tests for Set.of factories
 - ... and 12 more: https://git.openjdk.org/jdk/compare/e4d1cff6...7f704c35

Changes: https://git.openjdk.org/jdk/pull/12498/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12498&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8302818
  Stats: 723 lines in 8 files changed: 674 ins; 0 del; 49 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