src/share/classes/java/util/AbstractCollection.java

Print this page

        

*** 356,365 **** --- 356,366 ---- * * @see #remove(Object) * @see #contains(Object) */ public boolean removeAll(Collection<?> c) { + Objects.requireNonNull(c); boolean modified = false; Iterator<?> it = iterator(); while (it.hasNext()) { if (c.contains(it.next())) { it.remove();
*** 389,398 **** --- 390,400 ---- * * @see #remove(Object) * @see #contains(Object) */ public boolean retainAll(Collection<?> c) { + Objects.requireNonNull(c); boolean modified = false; Iterator<E> it = iterator(); while (it.hasNext()) { if (!c.contains(it.next())) { it.remove();