BlockingDeque contains() method in Java with Examples
The contains(Object o) method of BlockingDeque checks if the passed element in the parameter exists in the container or not. It returns true if the element exists in the container else it returns a false value.
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.
public boolean contains(Object o)
Parameters: This method accepts a mandatory parameter o whose presence in the container is to be checked in the container.
Returns: This method returns true if the element is present, else it returns false.
Note: The contains() method of BlockingDeque has been inherited from the LinkedBlockingDeque class in Java.
Below programs illustrate contains() method of BlockingDeque:
Blocking Deque: [10, 20, 30, 40] Blocking Deque contains 10
Blocking Deque: [ab, cd, fg, xz] Blocking Deque does not contain 'go'