/**
 * Represents a node in a linked list.  Each node contains an element and a
 * reference to the next node in the list.
 *
 * @author Nathan Sprague (April 2010)
 * @author Alyce Brady (most recently in September 2025)
 * @author Your Name
 * @version The Date
 */
public class K_LLNode<T>
{
    private T element; 
    private K_LLNode<T> next;

    /**
     * Creates an empty node. 
     */
    public K_LLNode()
    {
        this.element = null;
        this.next = null;
    }

    /**
     * Creates a node with an element. 
     * @param element - the element that the node will contain
     */
    public K_LLNode(T element)
    {
        this.element = element;
        this.next = null;
    }

    /**
     * Returns the element contained in this node. 
     * @return
     */
    public T getElement()
    {
        return this.element;
    }

    /**
     * Sets the element contained in this node. 
     * @param elem - the element to be stored at this node
     */
    public void setElement(T elem)
    {
        this.element = elem;
    }

    /**
     * Returns the next node in the list. 
     * @return
     */
    public K_LLNode<T> getNext()
    {
        return this.next;
    }

    /**
     * Sets the next node reference for this node. 
     * @param next - The node that will follow this node.
     */
    public void setNext(K_LLNode<T> nextNode)
    {
        this.next = nextNode;
    }

}
