Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8156070 Immutable Collections enhancements
  3. JDK-8165396

remove dependency on AbstractList, AbstractCollection, AbstractMap

    Details

    • Type: Sub-task
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: tbd
    • Component/s: core-libs
    • Labels:
      None

      Description

      The immutable lists are currently based on the AbstractList. This made bringup of the collection quick and easy. Unfortunately, this class includes a protected field modCount, which of course isn't used in the immutable collections. This takes up extra space in every instance. There are similar issues for Set and Map.

      It would be nice to refactor things to avoid this. An alternative would be to have something like AbstractImmutableList etc. that had the algorithms but not the extra space. The mutator method implementations would also throw UOE unconditionally instead of deferring to mutators that might or might not be overridden in subclasses. This implementation could also be shared with dependent collections like subList(), entrySet(), etc. derived from immutable collections.

        Attachments

          Activity

            People

            • Assignee:
              smarks Stuart Marks
              Reporter:
              smarks Stuart Marks
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: