Enumeration and Iterator both are
interfaces present in util package. Enumeration is a legacy interface which
does not come under the collection framework, wheras Iterator is an
interface present in the collection framework. All the legacy classes like
Stack, Vector , Hashtable, Properties can use Enumeration for enumerating
the elements from the collection. The classes under the collection
framework like ArrayList, LinkedList, HashSet ,Tree Set etc can use the
Iterator interface.
Iterator actually adds one method that Enumeration doesn't has: remove().
|
No comments:
Post a Comment