private void printFrontier(HashMap<Integer,Integer> frontier) {
        if (!this.isRoot()) {
            throw new IllegalStateException("Can only call printFrontier from the root node.");
        }
        for (ITrieNode t: this.children.values()) {
            printNode(t, frontier);
        }
    }