Optimize wrapper sets and immutable sets of Enums

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • None
    • Affects Version/s: 11, 19
    • Component/s: core-libs
    • None

      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 Enums.

      These sets can be optimized without changing public APIs.

      Notes:
      1. The immutable sets will have their iteration order changed, but that's allowed by the API specification.
      2. There may be performance impact as there are extra checks to create enum-specific collections.

            Assignee:
            Stuart Marks
            Reporter:
            Chen Liang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: