
/* Implements a node in a linked list for GraphAdjacencyList */

class Node<T> {

  protected Node<T> next;
  protected T data;

  public Node (T value) {
    this.data = data;
    this.next = null;
  }

  protected void appendToTail(Node<T> tailNode) {
    Node<T> curr = this;

    while(curr.next != null) {
      curr = curr.next;
    }

    /* Set the end node */
    curr.next = tailNode;
    return;
  }

}

@@ -406,10 +406,450 @@
 n;%0A  %7D%0A%0A
+  /* Remove the node with data and return the new head node. */%0A  protected Node%3CT%3E delete(Node%3CT%3E head, T data) %7B%0A    /* Deleting the first node, move the head over. */%0A    if (this.data == data) %7B%0A      return head.next;%0A    %7D%0A%0A    Node%3CT%3E curr = head;%0A%0A    while(curr.next != null) %7B%0A      if (curr.next.data == data) %7B%0A        curr.next = curr.next.next;%0A        return curr;%0A      %7D%0A      curr = curr.next;%0A    %7D%0A%0A    return head;%0A  %7D%0A
 %7D%0A

Implement AdjacencyList delete.