RFR: jsr166 jdk integration 2018-05 (original) (raw)

Martin Buchholz martinrb at google.com
Tue May 15 23:32:42 UTC 2018


On Tue, May 15, 2018 at 11:35 AM, Martin Buchholz <martinrb at google.com> wrote:

Your argument above applies to List.set just as much as List.repladeAll, because the latter is nothing more semantically than a bunch of calls to the former. They should have the same behavior. Not having the same behavior leads to inconsistency, seen today in subList operations on ArrayList and Vector having different modCount behavior than on the root list.

To strengthen that, the default method List.replaceAll is specified to be equivalent to

 final ListIterator<E> li = list.listIterator();
 while (li.hasNext()) {
     li.set(operator.apply(li.next()));
 }

https://download.java.net/java/early_access/jdk11/docs/api/java.base/java/util/List.html#replaceAll(java.util.function.UnaryOperator) and incrementing modCount breaks "equivalent to"



More information about the core-libs-dev mailing list