m865.datastructures
Class StackLL.StackLLIterator

java.lang.Object
  extended bym865.datastructures.StackLL.StackLLIterator
All Implemented Interfaces:
java.util.Iterator
Enclosing class:
StackLL

public class StackLL.StackLLIterator
extends java.lang.Object
implements java.util.Iterator

An iterator for an ArrayList stack.


Constructor Summary
protected StackLL.StackLLIterator(StackLL s)
          Constructor for a StackLLIterator
 
Method Summary
 boolean hasNext()
          Determines if there is an object in 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

StackLL.StackLLIterator

protected StackLL.StackLLIterator(StackLL s)
Constructor for a StackLLIterator

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

hasNext

public boolean hasNext()
Determines if there is an object in 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. Throws an UnsupportedOperationException.

Specified by:
remove in interface java.util.Iterator