Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsSingletonExample2 { public static void main(String[] args) { List
list = new ArrayList<>(); Collections.addAll(list, "A", "B", "C", "A", "C", "D", "C"); System.out.println(list); list.remove("B"); System.out.println(list); list.removeAll(Collections.singleton("C")); System.out.println(list); } }
Output