Class LinkedList

java.lang.Object
  |
  +--LinkedList

public class LinkedList
extends java.lang.Object

Class LinkedList A minimal LinkedList class composed of Node objects for 15-111/200 Mastery Exam/Fall 2002 You need to add a method to this class as described in the instructions. You may add additional helper (private) methods if you choose, but you may not add additional public methods, nor may you change those methods that we have defined. Name: Section: Date: andrew e-mail:


Constructor Summary
LinkedList()
          Default constructor: sets head to null, count to 0
 
Method Summary
 void addFirst(java.lang.Comparable item)
          Inserts a Comparable item at the beginning of the list
 boolean isEmpty()
          Tests list to see if it is empty
 int size()
          Returns the number of nodes in the list
 java.lang.String toString()
          Returns a string representation of the list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LinkedList

public LinkedList()
Default constructor: sets head to null, count to 0
Method Detail

size

public int size()
Returns the number of nodes in the list
Returns:
int the value of count

isEmpty

public boolean isEmpty()
Tests list to see if it is empty
Returns:
boolean: true if the list is empty

addFirst

public void addFirst(java.lang.Comparable item)
Inserts a Comparable item at the beginning of the list
Parameters:
Comparable - item to be added into the LinkedList

toString

public java.lang.String toString()
Returns a string representation of the list
Overrides:
toString in class java.lang.Object
Returns:
String