Trie data structure implementation for Java