DAT
Class LinkedList

java.lang.Object
  extended by DAT.LinkedList

public class LinkedList
extends java.lang.Object

A basic recursive (linked) list.


Constructor Summary
LinkedList()
          Create an empty list.
 
Method Summary
 void delete()
          Delete an object from the front of the list.
 java.lang.Object examine()
          Examine the first item in the list.
 void insert(java.lang.Object x)
          Insert an object at the front of the list.
 boolean isEmpty()
          Test whether the list is empty.
 java.lang.String toString()
          Construct a string representation of the list, based on the items' toString() methods, with each item on a new line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LinkedList

public LinkedList()
Create an empty list.

Method Detail

isEmpty

public boolean isEmpty()
Test whether the list is empty.

Returns:
true if the list is empty, false otherwise

insert

public void insert(java.lang.Object x)
Insert an object at the front of the list.

Parameters:
x - the object to insert

examine

public java.lang.Object examine()
                         throws Underflow
Examine the first item in the list.

Returns:
the first item in the list
Throws:
Underflow - if the list is empty

delete

public void delete()
            throws Underflow
Delete an object from the front of the list.

Throws:
Underflow - if the list is empty

toString

public java.lang.String toString()
Construct a string representation of the list, based on the items' toString() methods, with each item on a new line.

Overrides:
toString in class java.lang.Object
Returns:
the string representation