src/share/classes/java/util/Collections.java

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

*** 3870,3879 **** --- 3870,3880 ---- } public boolean retainAll(Collection<?> c) { return batchRemove(c, true); } private boolean batchRemove(Collection<?> c, boolean complement) { + Objects.requireNonNull(c); boolean modified = false; Iterator<Map.Entry<K,V>> it = iterator(); while (it.hasNext()) { if (c.contains(it.next()) != complement) { it.remove();