previous | start | next

LinkListIterator's add Method

   private class LinkedListIterator implements ListIterator
   {  . . .
      public void add(Object obj)
      {
         if (position == null)
         {
            addFirst(obj);
            position = first;
         }
         else
         {
            Link newLink = new Link();
            newLink.data = obj;
            newLink.next = position.next;
            position.next = newLink;
            position = newLink;
         }
         previous = null;
      }
      . . .
   }


previous | start | next