LinkedBlockingDeque removeAll() method in Java with Examples
The removeAll() method of LinkedBlockingDeque is an in-built function is Java which is used to remove from this deque all of its elements that are contained in the specified collection. That means, all the common elements these two collections are removed from this deque.
public boolean removeAll(Collection c)
Parameters: This method takes collection c as a parameter containing elements to be removed from this list.
Return Value: This method returns true if this deque changed as a result of the call.
Exceptions: This method throws NULL Pointer Exception if the specified collection is Null.
Below program illustrates the removeAll() function of LinkedBlockingDeque class:
Linked Blocking Deque: [11, 22, 33, 44] ArrayList to be removed: [55, 11, 23, 22] Current Linked Blocking Deque: [33, 44]
Linked Blocking Deque: [geeks, Geeks, gfg, Gfg] ArrayList: [GeeksforGeeks, Geeks, gfg, Gfg] Linked Blocking Deque: [geeks]
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.