package username.dict; import java.io.PrintWriter; /** * Dictionaries that can have specified index and value types. * * @author Samuel A. Rebelsky * @version 1.1 of April 2006 */ public interface Dict { /** * Add something to the dictionary (or replace something already * in the dictionary). * * @pre * key is not null. * @pre * value is not null. * @post * this.get(key) returns value. */ public void put(K key, V value); /** * Get something from the dictionary. * * @pre * key is not null. * @post * Returns the most recent value for this.put(index,value). * @exception NoSuchKeyException * If the key does not appear in the dictionary. */ public V get(K key) throws NoSuchKeyException; /** * Dump the dictionary to the screen or to a file. */ void dump(PrintWriter pen); } // interface Dict