Class LinkedList

java.lang.Object
  |
  +--LinkedList

public class LinkedList
extends java.lang.Object

This class is used for implementing a queue as a linked list.


Constructor Summary
LinkedList()
          Create an new LinkedList, initially empty.
 
Method Summary
 void addTo(java.lang.Object o)
          Add an Object to the end of the LinkedList
protected  LinkedListNode getFirstNode()
          Get the first LinkedListNode on a LinkedList
 boolean isEmpty()
          See if a LinkedList is empty.
 java.lang.Object removeFrom()
          Remove an Object from the front of the LinkedList.
 java.lang.String toString()
          Print out a string representation of a LinkedList.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LinkedList

public LinkedList()
Create an new LinkedList, initially empty.
Method Detail

addTo

public void addTo(java.lang.Object o)
Add an Object to the end of the LinkedList
Parameters:
o - The Object to be added

removeFrom

public java.lang.Object removeFrom()
Remove an Object from the front of the LinkedList. This returns null if the list is empty.
Returns:
The Object at the front of the LinkedList.

toString

public java.lang.String toString()
Print out a string representation of a LinkedList. This assumes that every Object implements the toString() method.
Overrides:
toString in class java.lang.Object
Returns:
A String representation of the LinkedList

isEmpty

public boolean isEmpty()
See if a LinkedList is empty.
Returns:
true if the LinkedList is empty, false otherwise.

getFirstNode

protected LinkedListNode getFirstNode()
Get the first LinkedListNode on a LinkedList
Returns:
The first LinkedListNode