What is an Iterator interface

The Iterator interface is used to step through the elements of a Collection.

Showing Answers 1 - 4 of 4 Answers

ramu

  • Mar 10th, 2006
 

Iterator interface is an interface which has these methods.

boolean hasNext();

Object next();

void remove();

  Was this answer useful?  Yes

madhu111

  • Jul 20th, 2007
 

Iterator Interface is part of java.util package.
It is used to retrive the elements in the collection object one by one.
It has methods like hasNext(),next().
the iterator interface is obtained by using iterator() on the collection object.
and the basic diff b/w iterator and list iterator  is iterator retrieves elements in forward dir.where list iterator retrieves  elements in both the directions. so list iterator is more efficient

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions