The java.util.concurrent.ConcurrentLinkedDeque.contains() method is an inbuilt method in Java which checks if the specified element, passed as a parameter, is present in the deque or not.
public boolean contains(Object elem)
Parameters: The method accepts a parameter elem which checks if the specified element is present in the deque or not.
Return Value: The function returns True if the element is present in the deque and returns False otherwise.
Below programs illustrate the ConcurrentLinkedDeque.contains() method:
ConcurrentLinkedDeque: [Welcome, To, Geeks, 4, Geeks] GFG is not present
ConcurrentLinkedDeque: [Welcome, To, Geeks, 4, Geeks] Geeks is present
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.