public class DictionaryImp2 extends PrefixTree implements Dictionary { //Constructor public DictionaryImp2() { super();} //Methods inherited from class PrefixTree //Dictionary methods implementation public boolean containsKey(String key) { return super.contains(key); } public boolean containsValue(Object value) { throw new UnsupportedOperationException(); } public Object get(String key) { PrefixTree t = super.search(key); return t != null ? t.data() : null; } public Object put(String key,Object value) { PrefixTree t = super.search(key); if(t != null) { Object r = t.marker; t.marker = value; return r; } t = super.insert(key); t.marker = value; return null; } public Object remove(String key) { throw new UnsupportedOperationException(); } public boolean equals(Object obj) { throw new UnsupportedOperationException(); } public java.util.Iterator keys() { return super.iterator(); } public java.util.Iterator values() { throw new UnsupportedOperationException(); } //Override public String toString() { String result = ""; java.util.Iterator it = keys(); while(it.hasNext()) { String key = (String)it.next(); Entry m = new Entry(key); m.setValue(get(key)); result = result + m + "\n"; } return result; } }