Java Collections emptyIterator() Method

The emptyIterator() method of Java Collections class is used to get an Iterator that has no elements.

Syntax

Following is the declaration of emptyIterator() method:

Parameter

This method does not accept any parameter.

Returns

The emptyIterator() method returns an empty Iterator.

Exceptions

NA

Compatibility Version

Java 1.7 and above

Example 1

Test it Now

Output:

Output: false

Example 2

Test it Now

Output:

Iterator list is empty.

Example 3

Test it Now

Output:

It is empty Iterator list.





Latest Courses