Home » Java ConcurrentLinkedQueue contains() Method

Java ConcurrentLinkedQueue contains() Method

by Online Tutorials Library

Java ConcurrentLinkedQueue contains() Method

The contains() method of ConcurrentLinkedQueue class returns a Boolean value true if the specified element is present in this queue.

Syntax:

Parameters:

o – this is the object that is to be checked for the presence in this queue.

Specified By:

The contains() method of ConcurrentLinkedQueue class is specified by contains() method in interface Collection<E>.

Override:

The contains() method of class ConcurrentLinkedQueue is overridden by :

contains() method in class AbstractCollection<E>.

Return Value:

The contains() method returns the Boolean value true if the specified element is present in this queue else it returns false.

Example 1

Test it Now

Output:

1.Ram  2.Sham  3.Mira  4.Rajesh  Ram is present  

Example 2

Output:

Incorrect answer!  

Example 3

Output:

Simran is present on 12.08.18  

You may also like