Program Base Library

pbliterator Implementation

Documentation

A pbIterator for pblLists
that allows the programmer to traverse the list in either direction,
modify the list during iteration, and obtain the iterator's current position in the list.
A ListIterator has no current element; its cursor position always lies between the element
that would be returned by a call to previous() and the element
that would be returned by a call to next().
In a list of length n, there are n+1 valid index values, from 0 to n, inclusive.

Note that the remove() and set(Object) methods are not defined in terms of the cursor position;
they are defined to operate on the last element returned by a call to next() or previous().

The pblIterators are fail-fast: if the list is structurally modified at any time after
the iterator is created, in any way except through the Iterator's own remove or add methods,
the iterator will return a PBL_ERROR_CONCURRENT_MODIFICATION error.

Thus, in the face of concurrent modification, the iterator fails quickly and cleanly,
rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future.

Constructors and Destructors

pblIteratorNew Returns an iterator over the elements in this collection in proper sequence.

pblIteratorReverseNew Returns a reverse iterator over the elements in this collection in proper sequence.