Java LinkedTransferQueue isEmpty() method

21 Mar 2025 | 2 min read

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

Output:

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

Example 2

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]