Online Java Compiler By
JavaTpoint.com
import java.util.ArrayList; public class ArrayListRemoveAllExample1 { ArrayList
letters = new ArrayList<>(); letters.add("A"); letters.add("B"); letters.add("C"); letters.add("D"); letters.add("E"); System.out.println(letters); // [A, B, C, D, E] ArrayList
removedLetters = new ArrayList<>(); removedLetters.add("C"); removedLetters.add("D"); removedLetters.add("E"); System.out.println(removedLetters); // [C, D, E] System.out.println(letters.removeAll(removedLetters)); //true System.out.println(letters); // [A, B] }
Output