Trie implementation for Java