VOOZH about

URL: https://www.geeksforgeeks.org/java/concurrentlinkedqueue-contains-method-in-java/

⇱ ConcurrentLinkedQueue contains() method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

ConcurrentLinkedQueue contains() method in Java

Last Updated : 26 Nov, 2018
The contains() method of ConcurrentLinkedQueue returns true if ConcurrentLinkedQueue contains the object o, passed as parameter. This method returns true if and only if this ConcurrentLinkedQueue contains at least one element e which is equal to object o passed as parameter i.e. o.equals(e). Syntax:
public boolean contains(Object o)
Parameter: This method takes a single parameter O which represents object to check whether ConcurrentLinkedQueue contains the specified object. Returns: This method returns true if this ConcurrentLinkedQueue contains the object. Below programs illustrate contains() method of ConcurrentLinkedQueue: Example 1:
Output:
ConcurrentLinkedQueue: [Aman, Amar, Sanjeet, Rabi]
queue contains String "Aman" : true
queue contains String "Ram" : false
Example 2:
Output:
ConcurrentLinkedQueue: [4353, 7824, 78249, 8724]
queue contains Number 78249 : true
queue contains Number 9876: false
Reference: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentLinkedQueue.html#contains-java.lang.Object-
Comment