Home » Java ConcurrentLinkedQueue isEmpty() Method with Examples

Java ConcurrentLinkedQueue isEmpty() Method with Examples

by Online Tutorials Library

Java ConcurrentLinkedQueue isEmpty() Method

The isEmpty() method of ConcurrentLinkedQueue class returns a Boolean value true if the defined queue contains no element. The isEmpty() method of class ConcurrentLinkedQueue is overrided by isEmpty() method in class AbstractCollection<E>.

Syntax

Parameter

NA

Specified By

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

Return Value

The isEmpty() method returns Boolean value true if the defined queue contains no element.

Example 1

Test it Now

Output:

Elements are : [1, 2, 3, 4, 5]  

Example 2

Test it Now

Output:

isEmpty() method returns true  Add some elements because the queue is empty.  

Example 3

Output:

Enter five names   1. Name = Reema  2. Name = Himanshu  3. Name = Rahul  Queue : [Reema, Himanshu, Rahul]  

You may also like