Please send questions to
st10@humboldt.edu .
/* Cs132ListNode.java 1.1 */
/* originally from Georgia Tech's CS 1322 Module 27 notes */
/* on Linked Lists, Stacks, and Queues */
/* modified/adapted by Sharon Tuttle */
/* last modified: 3-7-03 */
/* is it more general if handles Object */
/* instances, or Comparable instances...? */
/* Trying just making lists of Objects. */
public class Cs132ListNode
{
/*------------------------------------
fields
-------------------------------------*/
// information we want to be in a linked list
private Object data;
// next node in the linked list
private Cs132ListNode next;
/*--------------------------------------
constructors
---------------------------------------*/
/* create a new node containing the desired data */
/* but not leading to any other node */
public Cs132ListNode (Object desiredData)
{
this.data = desiredData;
this.next = null;
}
/*-------------------------------------------------------
accessors
-------------------------------------------------------*/
public Object getData()
{
return this.data;
}
public Cs132ListNode getNext()
{
return this.next;
}
/*-------------------------------------------------------
modifiers
-------------------------------------------------------*/
public void setData(Object newData)
{
this.data = newData;
}
public void setNext(Cs132ListNode newNext)
{
this.next = newNext;
}
/*------------------------------------------
overridden methods
-------------------------------------------*/
public String toString()
{
/* hmm; I don't think I'll print next in list... */
return "Cs132ListNode[" + this.data + "]";
}
} // end of class Cs132ListNode