/* Instances of this class are for the purpose of building linear chains ** of elements that can be easily traversed in either direction. Each ** one contains a data item (of interest to the client program) and ** references 'prev' and 'next' to, respectively, a "predecessor" and ** a "successor". ** ** Author: R. McCloskey ** Date: Sept. 2020 */ public class Link2 { public T item; // data of interest to the client public Link2 prev; // points to predecessor public Link2 next; // points to successor /* Initializes this new Link2 object by placing into its three ** fields the values of the given parameters. */ public Link2(T item, Link2 prev, Link2 next) { this.item = item; this.prev = prev; this.next = next; } /* Initializes this new Link2 object by placing the given value ** into its 'item' field and null values into its other two fields. */ public Link2(T item) { this(item, null, null); } }