Enumeration
The enumeration interface declares the methods through that you can enumerate the components in a collection of objects. An Iterator has this legacy interface. While not deprecated, A Enumeration is considered obsolete for new code. Moreover, it is used through various methods declared through the legacy classes, is used by various other API classes, and is currently in huge spread use in application code.
Enumeration specifies the next two methods:
Boolean hasMoreElements()
Object nextElement()
When you implemented, hasMoreElements() it must return true while there are yet more elements to extract and false when all their elements have been enumerated. nextElement() returns the next objects in the enumeration as a generic Object reference. That is, every call to nextElement() acquire the next object in the enumeration. The calling routine must cast which object into the object type held in the Enumeration.