import java.util.Hashtable; public class DefaultMemoDatabase implements MemoDatabase { private Hashtable associations; public DefaultMemoDatabase() { associations = new Hashtable(); } public boolean insert( MemoAssociation newEntry ) { if ( containsKey( newEntry.key() ) ) return false; associations.put( newEntry.key(), newEntry.value() ); return true; } public String find( String key ) { if ( containsKey( key ) ) return (String) associations.get( key ); // why the cast? return null; } public boolean remove( String key ) { if ( containsKey( key ) ) { associations.remove( key ); return true; } return false; } public boolean containsKey( String key ) { return associations.containsKey( key ); } }