previous | start | next

Turning LinkedList into a Generic Class

public class LinkedList<E>
{
. . .
public E removeFirst()
{
if (first == null)
throw new NoSuchElementException();
E element = first.data;
first = first.next;
return element;
}
. . .
private Node first;

private class Node
{
public E data;
public Node next;
}
}

previous | start | next