src/share/classes/java/util/List.java
Print this page
@@ -394,15 +394,17 @@
* If the list's list-iterator does not support the {@code set} operation
* then an {@code UnsupportedOperationException} will be thrown when
* replacing the first element.
*
* @param operator the operator to apply to each element
- * @throws UnsupportedOperationException if the {@code set}
- * operation is not supported by this list
+ * @throws UnsupportedOperationException if this list is unmodifiable.
+ * Implementations may throw this exception if a matching element
+ * cannot be replaced or if, in general, modification is not
+ * supported
* @throws NullPointerException if the specified operator is null or
- * if the element is replaced with a null value and this list
- * does not permit null elements
+ * if the operator result is a null value and this list does
+ * not permit null elements
* (<a href="Collection.html#optional-restrictions">optional</a>)
* @since 1.8
*/
default void replaceAll(UnaryOperator<E> operator) {
Objects.requireNonNull(operator);
@@ -683,6 +685,5 @@
@Override
default Spliterator<E> spliterator() {
return Spliterators.spliterator(this, Spliterator.ORDERED);
}
}
-