m865.datastructures
Class StackAL.StackALIterator

java.lang.Object
  extended bym865.datastructures.StackAL.StackALIterator
All Implemented Interfaces:
java.util.Iterator
Enclosing class:
StackAL

protected class StackAL.StackALIterator
extends java.lang.Object
implements java.util.Iterator

An iterator for an ArrayList stack.


Constructor Summary
protected StackAL.StackALIterator(StackAL s)
          Constructor for an StackAL iterator
 
Method Summary
 boolean hasNext()
          Determines if there is an object in the stack that can be returned by next().
 java.lang.Object next()
          Returns the next object in stack, if there is one.
 void remove()
          This method is an optional method of the Iterator interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackAL.StackALIterator

protected StackAL.StackALIterator(StackAL s)
Constructor for an StackAL iterator

Parameters:
s - the stack for this iterator.
Method Detail

hasNext

public boolean hasNext()
Determines if there is an object in the stack that can be returned by next().

Specified by:
hasNext in interface java.util.Iterator
Returns:
true - if there is an object in the stack that can be returned by next().

next

public java.lang.Object next()
Returns the next object in stack, if there is one. It throws a ConcurrentModificationException if the stack has been changed during the iteration.

Specified by:
next in interface java.util.Iterator
Returns:
the next object in the stack.

remove

public void remove()
This method is an optional method of the Iterator interface. If implemented, it would remove from the stack the last element returned by the iterator. Since this would violate the integrity of the abstract stack data structure it is not implemented. If invoked this method throws an UnsupportedOperationException

Specified by:
remove in interface java.util.Iterator