The retainAll() 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 retainAll(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 retainAll() function of LinkedBlockingDeque class:
Please Login to comment...