Results 1 to 4 of 4

Thread: iterator

  1. #1
    venkatallu is offline Member
    Join Date
    Sep 2008
    Rep Power

    Default iterator

    what is the difference between Iterator and Enumeration

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power


    Could you copy and paste the the API doc for those two classes as a starting point?

  3. #3
    Supamagier is offline Senior Member
    Join Date
    Aug 2008
    Rep Power


    Enumeration: An object that implements the Enumeration interface generates a series of elements, one at a time. Successive calls to the nextElement method return successive elements of the series.
    Iterator: An iterator over a collection. Iterator takes the place of Enumeration in the Java collections framework. Iterators differ from enumerations in two ways:

    Iterators allow the caller to remove elements from the underlying collection during the iteration with well-defined semantics.
    Method names have been improved.
    I suggest you use an Iterator.

    There you go.
    I die a little on the inside...
    Every time I get shot.

  4. #4
    satu is offline Member
    Join Date
    Aug 2008
    Rep Power


    using Enumeration one can Iterate over a Collection of elements.
    Iterator is same like that but able to delete the elements from the Collection.

Similar Threads

  1. Implementing Iterator
    By Harb in forum New To Java
    Replies: 13
    Last Post: 11-21-2009, 08:25 PM
  2. iterator issues
    By orchid in forum New To Java
    Replies: 2
    Last Post: 08-12-2008, 01:43 PM
  3. Iterator
    By eva in forum New To Java
    Replies: 0
    Last Post: 01-31-2008, 03:07 PM
  4. using Iterator with Vector
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-13-2007, 11:52 AM
  5. How to use an Iterator in java
    By lenny in forum New To Java
    Replies: 2
    Last Post: 07-25-2007, 07:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts