// ShortSequenceLinkedListIterator.java

/**
 * Iterator over a linked list of <code>short</code>.
 */
public class ShortSequenceLinkedListIterator
{
   /**  First node in remaining portion of linked list  */
   private ShortNode node;

   public ShortSequenceLinkedListIterator(ShortNode first)
   {
      node = first;
   }

   public boolean hasNext()
   {
      return ( node != null );
   }

   public short next()
   {
      if ( node == null )
         throw new NullPointerException("Linked list empty.");
      short currentData = node.data;
      node = node.next;
      return currentData;
   }
}  // class ShortSequenceLinkedListIterator