All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Interface DataStructures.ListItr

public interface ListItr
Protocol for list iterators using a header node.

See Also:
List

Method Index

 o advance()
Advance the current position to the next node in the list.
 o find(Object)
Set the current position to the first node containing an item.
 o first()
Set the current position to the first node in the list.
 o insert(Object)
Insert after the current position.
 o isInList()
Test if the current position references a valid list item.
 o remove(Object)
Remove the first occurrence of an item.
 o retrieve()
Return the item stored in the current position.
 o zeroth()
Set the current position to the header node.

Methods

 o insert
public abstract void insert(Object x) throws ItemNotFound
Insert after the current position. Current is set to the inserted node on success.

Parameters:
x - the item to insert.
Throws: ItemNotFound
if the current position is null.
 o find
public abstract boolean find(Object x)
Set the current position to the first node containing an item. current is unchanged if x is not found.

Parameters:
x - the item to search for.
Returns:
true if the item is found, false otherwise.
 o remove
public abstract void remove(Object x) throws ItemNotFound
Remove the first occurrence of an item. current is set to the first node on success; remains unchanged otherwise.

Parameters:
x - the item to remove.
Throws: ItemNotFound
if the item is not found.
 o isInList
public abstract boolean isInList()
Test if the current position references a valid list item.

Returns:
true if the current position is not null and is not referencing the header node.
 o retrieve
public abstract Object retrieve()
Return the item stored in the current position.

Returns:
the stored item or null if the current position is not in the list.
 o zeroth
public abstract void zeroth()
Set the current position to the header node.

 o first
public abstract void first()
Set the current position to the first node in the list. This operation is valid for empty lists.

 o advance
public abstract void advance()
Advance the current position to the next node in the list. If the current position is null, then do nothing. No exceptions are thrown by this routine because in the most common use (inside a for loop), this would require the programmer to add an unnecessary try/catch block.


All Packages  Class Hierarchy  This Package  Previous  Next  Index