src/share/classes/java/util/AbstractSet.java

Print this page
rev 7046 : 4802647: Throw required NPEs from removeAll()/retainAll()
Reviewed-by: mduigou, chegar, dholmes
Contributed-by: Brandon Passanisi <brandon.passanisi@oracle.com>

*** 164,173 **** --- 164,174 ---- * or if the specified collection is null * @see #remove(Object) * @see #contains(Object) */ public boolean removeAll(Collection<?> c) { + Objects.requireNonNull(c); boolean modified = false; if (size() > c.size()) { for (Iterator<?> i = c.iterator(); i.hasNext(); ) modified |= remove(i.next());