Simple Java solution using Trie with HashMap
\n\n\nclass WordDictionary {\n\n    private TrieNode root;\n    \n    /** Initialize your data structure here. */\n    public class TrieNode {\n        public M
\n\n```\nclass WordDictionary {\n\n    private TrieNode root;\n    \n    /** Initialize your data structure here. */\n    public class TrieNode {\n        public Map<Character, TrieNode> children = new HashMap<>();\n        public boolean isWord;\n    }\n    \n    public WordDictionary() {\n        root = new TrieNode();\n    }\n    \n    /** Adds a word into the data structure. */\n    public void addWord(String word) {\n       \n        TrieNode temp = root;\n\n        for (char c : word.toCharArray()) {\n            if (temp.children.get(c) == null)\n                temp.children.put(c, new TrieNode());\n\n            temp = temp.children.get(c);\n        }\n\n        temp.isWord = true;\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        return match(word.toCharArray(), 0, root);\n    }\n    \n    private boolean match(char[] chs, int k, TrieNode node) {\n\n        if (k == chs.length)\n            return node.isWord;\n\n        if (chs[k] == \'.\') {\n            for (Character curr: node.children.keySet()) {\n                if (node.children.get(curr) != null && match(chs, k+1, node.children.get(curr)))\n                    return true;\n            }\n        } else \n            return node.children.get(chs[k]) != null && match(chs, k + 1, node.children.get(chs[k]));\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```\n
[]