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

Optimize ArrayList subList replaceAll

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P3
    • 11
    • None
    • core-libs
    • 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

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

                Dates

                  Created:
                  Updated:
                  Resolved: