csc241.samples.stringList
Class stringLinkedListSortedItr

java.lang.Object
  |
  +--csc241.samples.stringList.stringLinkedListItr
        |
        +--csc241.samples.stringList.stringLinkedListSortedItr

public class stringLinkedListSortedItr
extends stringLinkedListItr

stringLinkedListSortedItr class inherits stringLinkedListItr and ensures that the list is maintained in an ascending order. The insert and addAtBeginning methods must be overridden to ensure the insertions don't violate keeping the order. insert places an element in its appropriate position in the list. addAtBeginning does nothing; all insertions must be done through the insert method.


Fields inherited from class csc241.samples.stringList.stringLinkedListItr
current_, myList_
 
Constructor Summary
stringLinkedListSortedItr(stringLinkedList anyList)
          Invoke the constructor for stringLinkedListItr.
 
Method Summary
 void insert(java.lang.String x)
          Insert x in its proper location in the list.
 void insertAtBeginning(java.lang.String x)
          Do nothing!
 
Methods inherited from class csc241.samples.stringList.stringLinkedListItr
advance, dump, find, first, remove, retrieve, validCurrent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

stringLinkedListSortedItr

public stringLinkedListSortedItr(stringLinkedList anyList)
Invoke the constructor for stringLinkedListItr. Construtor assumes that the list is either empty or already sorted.
Parameters:
anyList - a LinkedList object to which this iterator is permanently bound.
Method Detail

insert

public void insert(java.lang.String x)
Insert x in its proper location in the list. current is set to the inserted node on success.
Overrides:
insert in class stringLinkedListItr
Parameters:
x - the item to insert.

insertAtBeginning

public void insertAtBeginning(java.lang.String x)
Do nothing!
Overrides:
insertAtBeginning in class stringLinkedListItr
Parameters:
x - the item to insert.