86
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
Output:
Elements are : [1, 2, 3, 4, 5]
Example 2
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]
Next TopicJava ConcurrentLinkedQueue