Javatpoint Logo
Javatpoint Logo

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]






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA