Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8302818

Optimize wrapper sets and immutable sets of Enums

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 11, 19
    • 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.

            smarks Stuart Marks
            liach Chen Liang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: