1 package org.feistymeow.textual;
3 import java.util.HashSet;
6 public class SimpleDictionary extends HashSet<String>
7 // or alternatively, BinaryTree<String>
8 // => what is BST implem for java! is it balanced?
11 private static final long serialVersionUID = 1L;
13 public SimpleDictionary(Set<String> words)
19 public SimpleDictionary(String words[])
21 for (String word : words) {
27 public int computeLongestWord()
29 previouslyComputedLongestWord = 1;
31 // hmmm: iterate on set to find longest.
33 // kludge implem placeholder.
34 previouslyComputedLongestWord = 100;
35 return previouslyComputedLongestWord;
38 public boolean lookup(String toFind)
40 return contains(toFind);
43 public int longestWord()
45 return previouslyComputedLongestWord;
48 int previouslyComputedLongestWord;