Iterator
Iterator is the interface and found in the java.util package.It has three methods
- hasNext()
- next()
- remove()
Enumeration
Enumeration is also an interface and found in the java.util package .An enumeration is an object that generates elements one at a time. It is used for passing through a collection, usually of unknown size.The traversing of elements can only be done once per creation.
It has following methods
- hasMoreElements()
- nextElement()
An iterator over a collection. Iterator takes the place of Enumeration in the Java collections framework.Iterators differ from enumerations by allowing the caller to remove elements from the underlying collection during the iteration.