/** An instance of this class contains a reference to an object of the ** specified type T (the generic type parameter) and a reference to ** an object of the same kind (i.e., Link1). The idea is that objects ** of this class can be used as building blocks of one-directional linked ** structures (i.e., one-way lists). ** ** Author: R. McCloskey ** Date: March 2012 */ public class Link1 { /* instance variables */ private T item; private Link1 next; /* constructors */ public Link1(T item, Link1 next) { this.item = item; this.next = next; } public Link1(T item) { this(item, null); } public Link1() { this(null, null); } /* observers */ public T getItem() { return item; } public Link1 getNext() { return next; } /* mutators */ public void setItem(T newItem) { item = newItem; } public void setNext(Link1 newNext) { next = newNext; } }