src/share/classes/java/util/Collection.java
Print this page
rev 8045 : 8023339: Refined Collection.removeIf UOE conditions
Reviewed-by: duke
@@ -377,12 +377,12 @@
*/
boolean removeAll(Collection<?> c);
/**
* Removes all of the elements of this collection that satisfy the given
- * predicate. Errors or runtime exceptions thrown by the predicate are
- * relayed to the caller.
+ * predicate. Errors or runtime exceptions thrown during iteration or by
+ * the predicate are relayed to the caller.
*
* @implSpec
* The default implementation traverses all elements of the collection using
* its {@link #iterator}. Each matching element is removed using
* {@link Iterator#remove()}. If the collection's iterator does not
@@ -391,13 +391,12 @@
*
* @param filter a predicate which returns {@code true} for elements to be
* removed
* @return {@code true} if any elements were removed
* @throws NullPointerException if the specified filter is null
- * @throws UnsupportedOperationException if the {@code remove}
- * method is not supported by this collection's
- * {@link #iterator}
+ * @throws UnsupportedOperationException if a matching element cannot be
+ * removed from this collection
* @since 1.8
*/
default boolean removeIf(Predicate<? super E> filter) {
Objects.requireNonNull(filter);
boolean removed = false;