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

Print this page
rev 7932 : 8021591: Additional explicit null checks
Reviewed-by: psandoz, martin, alanb

@@ -3877,10 +3877,11 @@
             }
             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();