CITS2200
Interface Iterator<E>


public interface Iterator<E>

A class for sequentially accessing collections The Iterator should initially be pointing before the first element of the collection, so the first call to next() returns the first element.


Method Summary
 boolean hasNext()
          tests if there is a next item to return
 E next()
          Returns the next element a moves the iterator to the next position.
 

Method Detail

next

E next()
       throws OutOfBounds
Returns the next element a moves the iterator to the next position.

Returns:
the next element in the collection
Throws:
OutOfBounds - if there is no next element

hasNext

boolean hasNext()
tests if there is a next item to return

Returns:
true if and only if there is a next item