Collections.emptyIterator() in Java

Collections.emptyIterator(): This method is available in java.util.Collections class of Java.

Syntax:

<Object> Iterator<Object> java.util.Collections.emptyIterator()

This method returns an iterator that has no elements.

Parameters: NA

Returns: an empty iterator.

Exceptions: NA

Approach

Java

import java.util.Collections;

public class CollectionsemptyIterator {
    public static void main(String[] args) {

        System.out.println(Collections.emptyIterator());

    }
}

Output:

java.util.Collections$EmptyIterator@182decdb


No comments:

Post a Comment