To generate successive elements from a series, we can use java iterator. It is an improvement over Enumeration interface. Iterator takes the place of Enumeration since jdk 1.2
It is a nice utility for collections. Every collection is unique on its own and imagine if we have have to write logic on our own for every collection when there is a need to iterate it. Instead, java forces a collection to deliver an iterator.
These nice utilities makes java lovable, isn’t it?
Important points to note:
We can iterate only in one direction
Iteration can be done only once. If you reach the end of series its done. If we need to iterate again we should get a new Iterator.