April 2019
Intermediate to advanced
360 pages
9h 17m
English
Java's Iterator interface is part of the java.util package and is a member of the Java collections framework. As you can see from the UML class diagram, the interface includes four methods:

The forEachRemaining() method iterates through an object's elements. The hasNext() method returns a Boolean value depending on whether there are more iterations to go through. The next() method simply returns the next sequential iteration element. The final method, remove(), removes that last iterated element from the object.
Read now
Unlock full access