Given a query string s and a set of all possible query strings, return all strings in the set that have s as a prefix
Hide implementation details of Trie


root should be private
current search and findWords methods should be private
write public version of search: should take only a String and call the private one
make TrieNode a private static inner class of Trie


Change storage of children

Storing 26 pointers, most of which will be null in regular usage, is wasteful. You should use a more compact data structure; perhaps a TreeMap&lt;Character, TrieNode&gt;. You could even extend TreeMap for a cleaner interface.

Only store characters once

You effectively store each character in two places: explicitly in TrieNode.content, and implicitly by the node's position in its parent's children array (or in the key of the children map if you take my recommendation above). If you grab the character in the previous round of recursion, you should not need the TrieNode.content field at all.

Fix bug using StringBuilder

In findWords if a node is a word and has children, the character will be appended twice.

Minor tweaks


write a Trie(Iterable&lt;String&gt; content) constructor
no need to store '*' in root
use List.forEach() instead of List.stream().forEach()
separate search functionality into findNode and findWords
change if (blah == true) to if (blah)
pass functions instead of using lambdas when possible
fix indentation -- your IDE should do this for you


Finally, variables names can often be shorter if their purpose is clear in context. For example: currentNode vs current. A lot of people say to "use descriptive variables names"; however, brevity can also help with readability as well.

My stab at the changes

class Trie {
    private static class TrieNode extends TreeMap&lt;Character, TrieNode&gt; {
        public boolean isWord;
    }

    private TrieNode root;

    public Trie(Iterable&lt;String&gt; content) {
        this();
        content.forEach(this::insert);
    }

    public Trie() {
        root = new TrieNode();
    }

    public void insert(String word) {
        TrieNode current = root;
        for (int i = 0; i &lt; word.length(); i++) {
            current = current.computeIfAbsent(word.charAt(i),
                              k -&gt; new TrieNode());
        }
        current.isWord = true;
    }

    public List&lt;String&gt; search(String word) {
        List&lt;String&gt; results = new ArrayList&lt;&gt;();

        TrieNode node = findNode(word, root, 0);
        if (node == null) {
            return results;
        }

        findWords(node, new StringBuilder(word), results);
        return results;
    }

    private TrieNode findNode(String word, TrieNode current, int index) {
        if (index == word.length()) {
            return current;
        }

        Character ch = word.charAt(index);
        if (!current.containsKey(ch)) {
            return null;
        }

        return findNode(word, current.get(ch), ++index);
    }

    private void findWords(TrieNode current, StringBuilder sb, List&lt;String&gt; results) {
        current.forEach((Character ch, TrieNode child) -&gt; {
            StringBuilder word = new StringBuilder(sb).append(ch);
            if (child.isWord) {
                results.add(word.toString());
            }
            findWords(child, word, results);
        });
    }
}


class TrieTest {
    public static void main(String args[]) {
        Trie trie = new Trie(Arrays.asList(new String[] { "dog", "dee", "deer", "deal" }));

        trie.search("de").forEach(System.out::println);
        System.out.println();

        trie.search("do").forEach(System.out::println);
        System.out.println();
    }
}