#include <iterator.h>
Public Member Functions | |
| ListIterator () | |
| bool | hasNext () const |
| bool | hasPrevious () const |
| T & | next () |
| T & | previous () |
| void | set (const T &) const |
| void | printInternal () const |
Private Attributes | |
| Node< T > * | current |
| bool | before |
Friends | |
| class | List< T > |
Implements a bidirectional iterator for List.
| ListIterator< T >::ListIterator | ( | ) |
Default constructor.
| bool ListIterator< T >::hasNext | ( | ) | const |
Returns true if this iterator has a next object.
| bool ListIterator< T >::hasPrevious | ( | ) | const |
Returns true if this iterator has a previous object.
| T & ListIterator< T >::next | ( | ) |
Returns a reference to the next object in this iterator. Directly throws NoSuchObject if this iterator does not have a next element.
| NoSuchObject | if no such object exists in this iterator |
| T & ListIterator< T >::previous | ( | ) |
Returns a reference to the previous object in this iterator. Directly throws NoSuchObject if this iterator does not have a next element.
| NoSuchObject | if no such object exists in this iterator |
| void ListIterator< T >::printInternal | ( | ) | const |
A utility method that prints the internal state of this iterator.
| void ListIterator< T >::set | ( | const T & | object | ) | const |
Sets the object last returned by this iterator to the specified object. Directly throws NoSuchObject if this iterator does not have a next element.
| object | the object to be set |
| NoSuchObject | if no such object exists |
1.8.6