Difference between iterator and enumeration?


Iterator
  • Iterator is a collection framework. 
  •   Using iterator you can read elements of collection and also you can add elements, update element, read elements and remove elements.
  • You can use iterator to access the elements of Array list, Vector, Linked list, HashSet ,TreeSet, LinkedHashSet.

Enumeration
  •  Enumeration is a legacy interface 
  •   Using enumeration only you can read the elements. 
  •   You can use enumeration to access the elements of vector only

0 comments :

Post a Comment