Home » Java Collections emptyIterator() Method with Examples

Java Collections emptyIterator() Method with Examples

by Online Tutorials Library

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.  

You may also like