Java LinkedTransferQueue isEmpty() method

The isEmpty() method of LinkedTransferQueue class returns a Boolean value true if the defined queue contains no element. This method overrides the isEmpty() method in class AbstractCollection.

Syntax:

Specified By:

The isEmpty() method of LinkedTransferQueue class is specified by isEmpty()method in interface Collection.

Return:

This method returns a Boolean value true if the given queue contains no elements.

Example 1

Test it Now

Output:

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

Example 2

Test it Now

Output:

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

Example 3

Output:

Enter three names 
1. Name = Jack
2. Name = Harry
3. Name = John
Queue : [Jack, Harry, John]





Latest Courses