src/share/classes/java/util/IdentityHashMap.java

Print this page
rev 7682 : 8021591: Additional explicit null checks
Reviewed-by: duke

*** 995,1004 **** --- 995,1005 ---- * Must revert from AbstractSet's impl to AbstractCollection's, as * the former contains an optimization that results in incorrect * behavior when c is a smaller "normal" (non-identity-based) Set. */ public boolean removeAll(Collection<?> c) { + Objects.requireNonNull(c); boolean modified = false; for (Iterator<K> i = iterator(); i.hasNext(); ) { if (c.contains(i.next())) { i.remove(); modified = true;
*** 1210,1219 **** --- 1211,1221 ---- * Must revert from AbstractSet's impl to AbstractCollection's, as * the former contains an optimization that results in incorrect * behavior when c is a smaller "normal" (non-identity-based) Set. */ public boolean removeAll(Collection<?> c) { + Objects.requireNonNull(c); boolean modified = false; for (Iterator<Map.Entry<K,V>> i = iterator(); i.hasNext(); ) { if (c.contains(i.next())) { i.remove(); modified = true;