This section demonstrates how to use the Java Arraylist RemoveAll
This section demonstrates how to use the Java Arraylist RemoveAll
import java.util.*; public class List1 { public static void main(String[] args) { String ar[]={"india","pakistan","United Kingdom","Japan","Korea"}; ArrayList list=new ArrayList(); ArrayList list1=new ArrayList(); list.add(ar[0]); list.add(ar[1]); list.add(ar[2]); list.add(ar[3]); list1.add("Japan"); list1.add("india"); System.out.println(list+" "); list.removeAll(list1); System.out.println(list+" "); } } Output [india, pakistan, United Kingdom, Japan] [pakistan, United Kingdom]