public interface Trie<T>
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(java.lang.String word) |
java.util.Set<java.util.Map.Entry<java.lang.String,T>> |
entrySet() |
Trie<T> |
filter(Pred<T> filter) |
Opt<T> |
get(java.lang.String word) |
java.lang.String |
getLongestPrefix() |
boolean |
isEmpty() |
<R> Trie<R> |
mapValues(Func<T,R> function) |
int |
size() |
Trie<T> |
subTrie(java.lang.String prefix) |
java.util.Map<java.lang.String,T> |
toMap() |
Trie<T> |
union(Trie<T> other) |
java.util.Collection<T> |
values() |
void |
visitWords(TrieVisitor<T> visitor)
Calls
TrieVisitor.visit(java.lang.String, T) for each word-value pair in this Trie. |
java.util.Collection<java.lang.String> |
words() |
int size()
boolean isEmpty()
true if this Trie does not contain any words.boolean contains(java.lang.String word)
word - The word to check.true if this Trie contains the word.Opt<T> get(java.lang.String word)
word - The word to retrieve the value for.java.lang.String getLongestPrefix()
Trie<T> subTrie(java.lang.String prefix)
prefix - The prefix to get a subTrie for.Trie with words that start with the prefix.<R> Trie<R> mapValues(Func<T,R> function)
R - Type to transform values to.function - Function to apply to each value in this Trie.Func.apply(T).Trie<T> filter(Pred<T> filter)
filter - Predicate that determines which values to keep in the Trie.Pred.test(T) returned true.Trie<T> union(Trie<T> other)
other - The other Trie of the union.void visitWords(TrieVisitor<T> visitor)
TrieVisitor.visit(java.lang.String, T) for each word-value pair in this Trie.visitor - The visitor that will visit each word-value pair.java.util.Collection<java.lang.String> words()
java.util.Collection<T> values()
java.util.Set<java.util.Map.Entry<java.lang.String,T>> entrySet()
Set containing all word-value pairs as entries from this Trie.java.util.Map<java.lang.String,T> toMap()
Map containing all word-value pairs from this Trie.