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

Optimize ArrayList subList replaceAll

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 11
    • Component/s: core-libs
    • Labels:
      None

      Backports

        Description

        ArrayList's subList implementation does not implement replaceAll, but it should, for better performance (most importantly, easier to inline).

        ArrayList.replaceAll and Vector.replaceAll are the only implementations that increment modCount. But they should not, since replaceAll is not a structural modification. For both ArrayList and Vector, replaceAll has different behavior on the root list and a sublist. List.replaceAll calls ListIterator.set, which is not a structural modification.
        Changing the modCount behavior of replaceAll was surprisingly contentious, so deferred to a future change. This change is retargeted as a pure optimization.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                martin Martin Buchholz
                Reporter:
                martin Martin Buchholz
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: