//NodeGeneric.java
//To be used as a external (not nested) class.

public class NodeGeneric<T>
{
    private T data; //Data in the node
    private NodeGeneric<T> next; //Link to next node

    //Two constructors
    public NodeGeneric(T dataPortion)
    {
        this(dataPortion, null);
    }

    public NodeGeneric
    (
        T dataPortion,
        NodeGeneric<T> nextNode
    )
    {
        data = dataPortion;
        next = nextNode;
    }

    //Two getters
    public T getData()
    {
        return data;
    }

    public NodeGeneric<T> getNext()
    {
        return next;
    }

    //Two setters
    public void setData(T data)
    {
        this.data = data;
    }

    public void setNext(NodeGeneric<T> next)
    {
        this.next = next;
    }
}

