@Test public void testIsGoodWord() { AnagramDictionary dict = new AnagramDictionary(words); assertTrue(dict.isGoodWord("stops", "pot")); assertFalse(dict.isGoodWord("pots", "pot")); assertFalse(dict.isGoodWord("abcdefg", "cat")); }
public boolean isGoodWord(String word, String base) { if (!wordSet.contains(word)) { return false; } if (word.contains(base)) { return false; } return true; }
AnagramDictionary { public boolean isGoodWord(String word, String base) { if (!wordSet.contains(word)) { return false; } if (word.contains(base)) { return false; } return true; } }
AnagramDictionary { public boolean isGoodWord(String word, String base) { if (!wordSet.contains(word)) { return false; } if (word.contains(base)) { return false; } return true; } AnagramDictionary(InputStream wordListStream); @VisibleForTesting  AnagramDictionary(String[] words); }
AnagramDictionary { public boolean isGoodWord(String word, String base) { if (!wordSet.contains(word)) { return false; } if (word.contains(base)) { return false; } return true; } AnagramDictionary(InputStream wordListStream); @VisibleForTesting  AnagramDictionary(String[] words); boolean isGoodWord(String word, String base); ArrayList<String> getAnagrams(String targetWord); ArrayList<String> getAnagramsWithOneMoreLetter(String word); String pickGoodStarterWord(); }
AnagramDictionary { public boolean isGoodWord(String word, String base) { if (!wordSet.contains(word)) { return false; } if (word.contains(base)) { return false; } return true; } AnagramDictionary(InputStream wordListStream); @VisibleForTesting  AnagramDictionary(String[] words); boolean isGoodWord(String word, String base); ArrayList<String> getAnagrams(String targetWord); ArrayList<String> getAnagramsWithOneMoreLetter(String word); String pickGoodStarterWord();  }