public default void replaceAll (UnaryOperator<E> operator)

Replaces each element of this list with the result of applying the operator to that element. Errors or runtime exceptions thrown by the operator are relayed to the caller.

Parameters:
operator    the operator to apply to each element

Exceptions:
UnsupportedOperationException    if this list is unmodifiable. Implementations may throw this exception if an element cannot be replaced or if, in general, modification is not supported
NullPointerException    if the specified operator is null or if the operator result is a null value and this list does not permit null elements (optional)

Since:  1.8

@implSpec The default implementation is equivalent to, for this list:


     final ListIterator<E> li = list.listIterator();
     while (li.hasNext()) {
         li.set(operator.apply(li.next()));
     
 }
If the list's list-iterator does not support the set operation then an UnsupportedOperationException will be thrown when replacing the first element.