Showing posts with label Iterator Vs ListIterator in collections. Show all posts
Showing posts with label Iterator Vs ListIterator in collections. Show all posts

What is the difference between Iterator and ListIterator?

  • Both are useful to retrieve elements from a collection.
  • Iterator can retrieve the elements only in forward direction.
  • But ListIterator can retrieve the elements in forward and backward direction also.
  • So ListIterator is preferred than Iterator