import java.util.LinkedList;
public class LinkedListRemoveAllElement {
public static void main(String[] args) {
LinkedList<String> ll = new LinkedList<>();
LinkedList<String> ll1 = new LinkedList<>();
//addding element to linkedlist ll
ll.add("Ishu");
ll.add("Nishu");
ll.add("Naina");
ll.add("Nishu");
ll.add("Shiksha");
System.out.println("Before removing element, the LinkedList is :");
System.out.println(ll);
//adding elements to linkedlist ll1
ll1.add("Ishu");
ll1.add("Naina");
ll1.add("Nishu");
//will remove all element common in both the linkedlist
ll.removeAll(ll1);
System.out.println("After removing element, the LinkedList is :");
System.out.println(ll);
}
}