public class Trie<K,V>
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
Trie.Node
The nodes in the trie.
|
| Constructor and Description |
|---|
Trie()
Constructor.
|
Trie(int initialCapacity)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Trie.Node |
get(K key)
Returns the node of a given key.
|
V |
get(K[] key)
Returns the associated value of a given key.
|
void |
put(K[] key,
V value)
Add a key with associated value to the trie.
|
int |
size()
Returns the number of entries.
|
public Trie()
public Trie(int initialCapacity)
initialCapacity - the initial capacity of root node.public void put(K[] key, V value)
key - the key.value - the value.public V get(K[] key)
key - the key.public Trie.Node get(K key)
key - the key.public int size()