public class Node { private Comparable data; private Node next; /* * Constructor. Initializes instance variables * to specified values */ public Node (Comparable data, Node next) { this.data = data; this.next = next; } /* * Constructor. Initializes data to the * specified value, and the next reference * to null */ public Node (Comparable data) { this.data = data; this.next = null; } /* * Returns the data */ public Comparable getData() { return data; } /* * Returns reference to next node */ public Node getNext() { return next; } /* * Sets the next reference to the specified value */ public void setNext(Node next) { this.next = next; } /* * Sets the data to the specified value * * We could have chosen not to implement this * method, and instead force users to create * new Node objects when they want to change * the data. */ public void setData(Comparable data) { this.data = data; } }