Java simple Trie implementation
\nclass TrieNode{\n    boolean isEnd = false;\n    TrieNode children[] = new TrieNode[26];\n}\n\nclass WordDictionary {\n    \n    /** Initialize your data stru
```\nclass TrieNode{\n    boolean isEnd = false;\n    TrieNode children[] = new TrieNode[26];\n}\n\nclass WordDictionary {\n    \n    /** Initialize your data structure here. */\n    TrieNode root;\n    public WordDictionary() {\n        root = new TrieNode();\n    }\n    \n    /** Adds a word into the data structure. */\n    public void addWord(String word) {\n        TrieNode temp = root;\n        \n        for(int i=0;i<word.length();i++){\n            char ch = word.charAt(i);\n            if(temp.children[ch-\'a\'] == null) temp.children[ch-\'a\'] = new TrieNode();\n            temp = temp.children[ch-\'a\'];\n        }\n        temp.isEnd = true;\n        \n    }\n    \n    /** Returns if the word is in the data structure. A word could contain the dot character \'.\' to represent any one letter. */\n    public boolean search(String word) {\n\n        TrieNode temp = root;\n        return search(word,0,temp);\n        \n    }\n    \n    public boolean search(String word,int i, TrieNode node){\n        if(node == null) return false;\n        \n        if(i == word.length()) return node.isEnd;\n        \n        char ch = word.charAt(i);\n        if(ch == \'.\'){\n            for(int k=0;k<26;k++){\n                if(search(word,i+1,node.children[k])) return true;\n            }\n        }else{\n            if(search(word,i+1,node.children[ch-\'a\'])) return true;\n        }\n\n        return false;\n    }\n}\n\n/**\n * Your WordDictionary object will be instantiated and called as such:\n * WordDictionary obj = new WordDictionary();\n * obj.addWord(word);\n * boolean param_2 = obj.search(word);\n */\n```
[]