E - the type of object returned by the iterator.public interface Iterator<E>
Iterator is used to sequence over a collection of objects.
 Conceptually, an iterator is always positioned between two elements of a
 collection. A fresh iterator is always positioned in front of the first
 element.
 
 If a collection has been changed since its creation, methods next and
 hasNext() may throw a ConcurrentModificationException.
 Iterators with this behavior are called fail-fast iterators.| Modifier and Type | Method and Description | 
|---|---|
boolean | 
hasNext()
Returns whether there are more elements to iterate, i.e. 
 | 
E | 
next()
Returns the next object in the iteration, i.e. 
 | 
void | 
remove()
Removes the last object returned by  
next from the collection. | 
boolean hasNext()
true if there are more elements, false otherwise.next()E next()
NoSuchElementException - if there are no more elements.hasNext()void remove()
next from the collection.
 This method can only be called once after next was called.UnsupportedOperationException - if removing is not supported by the collection being
             iterated.IllegalStateException - if next has not been called, or remove has
             already been called after the last call to next.