From charlesreid1

Revision as of 07:00, 19 June 2017 by Admin (talk | contribs)

Also see Java/Iterable#Iterable vs Iterator

Iterator is a wrapper class - think of it as a lightweight scanner object for an iterable data container.

The Linked List class (javadocs link) utilizes a ListIterator class (javadocs link). The ListIterator class is basically similar to the Iterator class but adds a few additional methods - add, hasPrevious, previous, hasNext, next, etc.

To get a ListIterator to a list, use listIterator() method.

To get a ListIterator to a list pointing to index i, use the listIterator(int i) method.