

/**
 * @author CIS121 Staff
 * A Singly Linked List.  This is just a class that stores a reference to an
 * element it contains and a reference to the next SinglyLinkedList object in the
 * list.
 *
 */
public class SinglyLinkedList<K> {
	private SinglyLinkedList<K> next = null;
	private final K el;
	
	
	/**Constructor 1
	 * @param el an element of generic type K to be stored
	 */
	public SinglyLinkedList(final K el){
		this.el = el;
	}
	
	/** Constructor 2
	 * @param next the next SinglyLinkedList object in this list
	 * @param el an element of generic type K to be stored
	 */
	public SinglyLinkedList(SinglyLinkedList<K> next, final K el) {
		this.next = next;
		this.el = el;
	}
	
	/** Returns the SinglyLinkedList object which this object references.
	 *  The next SinglyLinkedList object in the list. Returns null if this is 
	 *  the head and the tail of the list.
	 * 
	 * @return the next element in this list (careful this could be null!)
	 */
	public SinglyLinkedList<K> getNext(){
		return next;
	}
	
	/** Sets the SinglyLinkedList object this references.
	 * @param next the new object to which this object points, can be null
	 */
	public void setNext(SinglyLinkedList<K> next){
		this.next = next;
	}
	
	/** Get the generic element this object stores
	 * @return the elemet stored by this object
	 */
	public K getElement(){
		return el;
	}	
	
	public static void main(String[] args){
	}
}
