The List ADT

Definition

A List is a dynamic, ordered tuple of homogeneous elements

A1, A2, A3, .... An where Ai is the i'th element of the List

Definition:

The position of an element Ai is i. Positions range from 1 to N, inclusive, NOT 0 to N - 1

Definition:

The size of a List is N. A List with no elements is called an empty list.


List Operations


Iterators

Definition:

An iterator is an object that provides access to elements of a collection (in a specified order) without exposing the underlying structure of the collection.


Iterator Operations


Scanning a collection

Iterator itr = collection.first ( ); for ( ; ! itr.isPastEnd ( ); itr.advance ( ) ) // do something with itr.retrieve

More List Operations