Removes
all of this collection's elements that are also contained in the specified collection.
package com.logicbig.example.arraydeque;
import java.util.ArrayDeque;
import java.util.List;
import java.util.Set;
public class RemoveAllExample3 {
public static void main(String... args) {
ArrayDeque<Integer> ad = new ArrayDeque<>(List.of(3, 8, 1));
System.out.println(ad);
boolean b = ad.removeAll(Set.of(8, null));
System.out.println(b);
System.out.println(ad);
}
}
Output
Caused by: java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:221)
at java.base/java.util.ImmutableCollections$Set2.<init>(ImmutableCollections.java:379)
at java.base/java.util.Set.of(Set.java:484)
at com.logicbig.example.arraydeque.RemoveAllExample3.main(RemoveAllExample3.java:17)
... 6 more