public class LinkedList { public class LinkedListException extends Exception { public LinkedListException(String s) { super (s); } } private Node head; private Node tail; private Node index; /* * Constructor. By default, set all the references * to null */ public LinkedList() { head = tail = index = null; } /* * This class does have other methods, but since you can't use them, * they are not included here. * * None-the-less, you must maintain index, head, tail, and the nodes * of the list in a meaningful state */ } /* End of class LinkedList */ public class Node { private Comparable data; private Node next; /* * Constructor. Initializes instance variables * to specified values */ public Node (Comparable data, Node next) { this.data = data; this.next = next; } /* * Constructor. Initializes data to the * specified value, and the next reference * to null */ public Node (Comparable data) { this.data = data; this.next = null; } /* * Returns the data */ public Comparable getData() { return data; } /* * Returns reference to next node */ public Node getNext() { return next; } /* * Sets the next reference to the specified value */ public void setNext(Node next) { this.next = next; } } /* End of class Node */