On Tue, May 15, 2018 at 11:35 AM, Martin Buchholz <marti...@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"

Reply via email to