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

Add specialized toArray methods to immutable collections

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 13
    • Component/s: core-libs

      Description

      The various List and Set implementations in java.util.ImmutableCollections inherit toArray from AbstractCollection, which uses iterators and has logic to account for changes to the underlying collection as you iterate over it (which can't happen in the case of immutable collections).

      Adding specialized implementations of toArray/toArray(T[]) to the various classes in java.util.ImmutableCollections can improve their performance, in some cases by a significant factor.

        Attachments

          Activity

            People

            Assignee:
            redestad Claes Redestad
            Reporter:
            redestad Claes Redestad
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: