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

Constructor Index

 o SortListItr(List)
Construct the list.

Method Index

 o insert(Comparable)
Insert in sorted order.
 o insert(Object)
Overridden to generate an exception.
 o main(String[])

Constructors

 o 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.

Methods

 o 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
 o 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.
 o main
public static void main(String[] args)

All Packages  Class Hierarchy  This Package  Previous  Next  Index