All Packages Class Hierarchy This Package Previous Next Index
Class DataStructures.SortListItr
java.lang.Object
|
+----DataStructures.LinkedListItr
|
+----DataStructures.SortListItr
- public class SortListItr
- extends LinkedListItr
Linked list implementation of the sorted list iterator
using a header node.
Insertions are done to maintian sorted order.
- See Also:
- LinkedList
-
SortListItr(List)
- Construct the list.
-
insert(Comparable)
- Insert in sorted order.
-
insert(Object)
- Overridden to generate an exception.
-
main(String[])
-
SortListItr
public SortListItr(List anyList) throws ClassCastException
- Construct the list.
The result of the construction is the same as for ListItr.
- Parameters:
- anyList - a LinkedList object to which this iterator is
permanently bound. This constructor is provided for
convenience. If anyList is not a LinkedList object, a
ClassCastException will result.
insert
public void insert(Object x) throws ItemNotFound
- Overridden to generate an exception. An insert routine
that accepts a Comparable object should be used.
- Parameters:
- x - an Object that is attempted to be inserted.
- Throws: ItemNotFound
- thrown if this method is executed.
- Overrides:
- insert in class LinkedListItr
insert
public void insert(Comparable x)
- Insert in sorted order.
Assumes that the list is already sorted.
current is set to the inserted node on success.
No exceptions are thrown.
- Parameters:
- x - the item to insert.
main
public static void main(String args[])
All Packages Class Hierarchy This Package Previous Next Index