Search This Blog

Sunday, 30 November 2014

Difference between Enumeration and Iterator

Enumeration:

  • Enumeration is the legacy class which is used on legacy Interface.
  • Enumeration is Fail Safe means we can modify the object in the retrieving time.
  • Enumeration is Introduced in Java 1.0
  • Enumeration has no any method for removing the element.
  • Enumeration method name are Big.


Iterator:

  • Iterator is not legacy class it is used for any type of collection.
  • Iterator is Fail Fast  means we can not modify the object at the retrieving time.
  • Iterator is Introduced in  Java 1.0.
  • Iterator has remove() method for removing the element.
  • Iterator method name are smaller than the Enumeration.

1 comment: