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

Add specialized toArray methods to immutable collections

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 13
    • None
    • core-libs

      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.

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

              Created:
              Updated:
              Resolved: