|
|
An occasional need in programming with Lists is the so-called linked list operations which involve manipulation of a position pointer to a List for examining, reading, or modifying the List. The operations may iterate over a List in two directions at the same time. In order to allow such operations, a List iterator class is provided. A List iterator is a separate class, not part of a List, and can be considered as a pointer pointing at a position in between two List elements.
For illustration of the operations in this section, diagrams of the following type will be used:
L = ( a b c d e f g h i j )
^
Li
Sample diagram
which represents a List L which contains the values a, b, c, d, e, f, g, h, i, j and for which the current position of the iterator Li is at the head of the List.