package username.dict; /** * A node used to implement the linked sequence of values in * a cell in a hash table. * * @author Samuel A. Rebelsky * @version 1.0 of April 2005 */ class Node { // +------------------+---------------------------------------- // | Design Decisions | // +------------------+ /* (1) This class has no public methods because it is intended solely for implementing a bucket-style hash table. (2) There are no methods in this class since the accessing class is intended to directly access the fields. (3) We've hit the end of a sequence of nodes when the next field is null. */ // +--------+-------------------------------------------------- // | Fields | // +--------+ /** * The key stored in this node. */ K key; /** * The corresponding value. */ V value; /** * A link to the next node. */ Node next; // +--------------+-------------------------------------------- // | Constructors | // +--------------+ /** * Build a new node with a specified next node. */ Node(K _key, V _value, Node _next) { this.key = _key; this.value = _value; this.next = _next; } // Node(K, V, Node) /** * Build a new node with no specified next node. */ Node(K _key, V _value) { this.key = _key; this.value = _value; } // Node(K,V) } // class Node