Week 5: Lab Document, 9/27


The implementation of the linked list class that I posted (Link, LinkList) is somewhat primitive in that, besides the constructor, it provides only four methods: insertFirst, find, delete, and displayList. The java.util package provides an implementation of the LinkedList class (see documentation) that is much more sophisticated and has about 30 methods.

Problem: Take a look at the documentation for the LinkedList class in java.util. This should give you a sense of the kinds of methods one might expect a LinkedList class to support. Add the following 5 methods to our implementation of the LinkList class:

  1. addLast
  2. clear
  3. element
  4. get
  5. removeFirst
These should have exactly the same meaning as the corresponding methods in Java's LinkedList class.