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

Optimize ArrayList subList replaceAll

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 11
    • None
    • core-libs
    • None

        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.

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

                Created:
                Updated:
                Resolved: