public Tree constructTrie(List<String> patternList) {
        trie = new Tree("", 1);

        Tree.Node root = trie.getRoot();
        List<Tree.Node<String, Integer>> children = new ArrayList<Tree.Node<String, Integer>>();
        root.setChildren(children);

        int positionOfNode = 2;

        for (String pattern : patternList) {
            List<Object> notInTreeList = findFirstNodeNotInTree(pattern, root);
            if (notInTreeList.size() > 0) {
                Tree.Node nodeNotInTree = (Tree.Node) notInTreeList.get(0);
                int position = (Integer) notInTreeList.get(1);
                pattern = pattern.substring(position);
                for (int i = 0; i < pattern.length(); i++) {
                    List<Tree.Node<String, Integer>> newChildren = new ArrayList<Tree.Node<String, Integer>>();
                    Tree.Node node = new Tree.Node();
                    node.setParent(nodeNotInTree);
                    node.setData(String.valueOf(pattern.charAt(i)));
                    node.setPosition(positionOfNode);
                    positionOfNode++;
                    node.setChildren(newChildren);
                    nodeNotInTree.getChildren().add(node);
                    nodeNotInTree = node;
                }
            }

        }
        trie.toString();
        return trie;
    }