ListNode

public class ListNode

{

    private int data; // Value we hold

    private ListNode next; // connection to next ListNode

    

    public ListNode (int val)

    {

        data = val;

        next = null; // This node doesn't point to anything

    }

    

    public int getData () { return data; }

    

    public ListNode getNext() { return next; }

    

    public void setNext (ListNode n) { next = n; }

    

    public void setData (int v) { data = v; }

}

This page was last modified on 8/25/09