Add a helper method
Change-Id: I7a898940d5f672bbee0da0c02af7a08297051ec3
This commit is contained in:
parent
c88026e1df
commit
eddfbb68dc
1 changed files with 10 additions and 0 deletions
|
@ -434,6 +434,16 @@ public class FusionDictionary implements Iterable<Word> {
|
||||||
return currentGroup;
|
return currentGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to find out whether a word is in the dict or not.
|
||||||
|
*/
|
||||||
|
public boolean hasWord(final String s) {
|
||||||
|
if (null == s || "".equals(s)) {
|
||||||
|
throw new RuntimeException("Can't search for a null or empty string");
|
||||||
|
}
|
||||||
|
return null != findWordInTree(mRoot, s);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively count the number of character groups in a given branch of the trie.
|
* Recursively count the number of character groups in a given branch of the trie.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue