src/share/classes/java/util/ArrayList.java

Print this page
rev 3977 : 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.

*** 626,638 **** * specified collection. * * @param c collection containing elements to be removed from this list * @return {@code true} if this list changed as a result of the call * @throws ClassCastException if the class of an element of this list ! * is incompatible with the specified collection (optional) * @throws NullPointerException if this list contains a null element and the ! * specified collection does not permit null elements (optional), * or if the specified collection is null * @see Collection#contains(Object) */ public boolean removeAll(Collection<?> c) { return batchRemove(c, false); --- 626,640 ---- * specified collection. * * @param c collection containing elements to be removed from this list * @return {@code true} if this list changed as a result of the call * @throws ClassCastException if the class of an element of this list ! * is incompatible with the specified collection ! * (<a href="Collection.html#optional-restrictions">optional</a>) * @throws NullPointerException if this list contains a null element and the ! * specified collection does not permit null elements ! * (<a href="Collection.html#optional-restrictions">optional</a>), * or if the specified collection is null * @see Collection#contains(Object) */ public boolean removeAll(Collection<?> c) { return batchRemove(c, false);
*** 644,656 **** * of its elements that are not contained in the specified collection. * * @param c collection containing elements to be retained in this list * @return {@code true} if this list changed as a result of the call * @throws ClassCastException if the class of an element of this list ! * is incompatible with the specified collection (optional) * @throws NullPointerException if this list contains a null element and the ! * specified collection does not permit null elements (optional), * or if the specified collection is null * @see Collection#contains(Object) */ public boolean retainAll(Collection<?> c) { return batchRemove(c, true); --- 646,660 ---- * of its elements that are not contained in the specified collection. * * @param c collection containing elements to be retained in this list * @return {@code true} if this list changed as a result of the call * @throws ClassCastException if the class of an element of this list ! * is incompatible with the specified collection ! * (<a href="Collection.html#optional-restrictions">optional</a>) * @throws NullPointerException if this list contains a null element and the ! * specified collection does not permit null elements ! * (<a href="Collection.html#optional-restrictions">optional</a>), * or if the specified collection is null * @see Collection#contains(Object) */ public boolean retainAll(Collection<?> c) { return batchRemove(c, true);