//
// ListNode.java
// This class represents a version of a "linked list" data structure, 
//    which stores objects in a list of nodes
// Each node stores some data object and a pointer to the next
//    node in the list, null if there is none
//
// Nadeem Abdul Hamid
// CSC121 - Berry College - Spring 2005
//

public class ListNode 
{
    private Object head;     // data that is being stored
    private ListNode tail;       // pointer to the rest of the list
    

    // this constructor creates a list with one element
    public ListNode( Object o ) 
    {
	head = o;
	tail = null;   // nothing else in this list so far
    } // end constructor


    // this constructs creates a bigger list from an existing one by
    // linking another object onto the front of it
    public ListNode( Object o, ListNode l )   
    {
	head = o;
	tail = l;
    } // end constructor
	

    // accessor methods
    public Object getHead() { return head; }  // gets the front of the list

    public ListNode getTail() { return tail; } // returns the rest of the list
    
} // end class ListNode


