Tuesday, November 29, 2011

Tell me the differences between enumeration and iteration?Which can use where in realtime?

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
Category:Java Interview Questions

No comments:

Post a Comment