/** * Node for a linked list of objects. * Demonstration program for CSE 143. * @author Hal Perkins * @version 0.1, 4/17/06 */ public class Link { // Note: member data is public since this is intended as a simple data // structure, not a complex object with encapsulated behavior. public E item; // item referenced by this link public Link next; // next node in the list or null if no next node // construct a new Link with given item and next fields public Link(E item, Link next) { this.item = item; this.next = next; } // construct a new Link with the given item and a null next reference public Link(E item) { this(item, null); } // construct a new Link without initializing any fields public Link() { this(null, null); } }