Class SortedList

java.lang.Object
  |
  +--LinkdList
        |
        +--SortedList

public class SortedList
extends LinkdList

SortedList.java Created: Mon Mar 3 16:38:01 2003

Author:
Stuart C. Shapiro

Field Summary
 
Fields inherited from class LinkdList
empty, first, rest
 
Constructor Summary
SortedList()
          Constructs an empty SortedList.
SortedList(Comparable obj, SortedList list)
          Constructs a new SortedList consisting of a Comparable object prepended to another list.
 
Method Summary
 boolean add(Object o)
          Unsupported
 SortedList insert(Comparable obj)
          Returns a SortedList like this one, but with obj inserted in its proper order.
 
Methods inherited from class LinkdList
get, getFirst, getRest, insert, isEmpty, remove, size, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SortedList

public SortedList()
Constructs an empty SortedList.


SortedList

public SortedList(Comparable obj,
                  SortedList list)
Constructs a new SortedList consisting of a Comparable object prepended to another list.

Parameters:
obj - the Comparable object to be the first element of this list.
list - a SortedList to be the rest of this list.
Throws:
IllegalArgumentException - if this list has a first element and obj does not compare as less than or equal to it.
Method Detail

add

public boolean add(Object o)
Unsupported

Overrides:
add in class LinkdList
Parameters:
o - an Object value
Returns:
a boolean value
Throws:
UnsupportedOperationException

insert

public SortedList insert(Comparable obj)
Returns a SortedList like this one, but with obj inserted in its proper order.

Parameters:
obj - a Comparable object to be inserted into this list.
Returns:
a SortedList like this one, but with obj inserted in its proper order.