public void add(String word) {
        if (word == null || word.isEmpty())
            return;
        Node localRoot = root;
        for (int i = 0; i < word.length(); i ++) {
            Character c = word.charAt(i);
            if (localRoot.children.containsKey(c)) {
                localRoot = localRoot.children.get(c);
            } else {
                Node node = new Node(c);
                localRoot.children.put(c, node);
                localRoot = node;
            }
        }
        localRoot.isLeaf = true;
    }