Repository: TheAlgorithms/Java
File: src/main/java/com/thealgorithms/strings/AhoCorasick.java (Java)

Code before:
            return suffixLink;
        }

        public void setSuffixLink(final Node suffixLink) {
            this.suffixLink = suffixLink;
        }

        public Node getOutputLink() {
            return outputLink;
        }

        public void setOutputLink(final Node outputLink) {
            this.outputLink = outputLink;
        }

        public int getPatternInd() {
            return patternInd;
        }

        public void setPatternInd(final int patternInd) {
            this.patternInd = patternInd;
        }
    }

    // Trie Class
    public class Trie {

        private Node root = null; // Root node of the trie
        private final String[] patterns; // patterns according to which Trie is constructed

        public Trie(final String[] patterns) {
            root = new Node(); // Initialize the root of the trie
            this.patterns = patterns;
            buildTrie();
            buildSuffixAndOutputLinks();
        }

        // builds AcoCorasick Trie
        private void buildTrie() {

            // Loop through each input pattern and building Trie
            for (int i = 0; i < patterns.length; i++) {
                Node curr = root; // Start at the root of the trie for each pattern

                // Loop through each character in the current pattern
                for (int j = 0; j < patterns[i].length(); j++) {
                    char c = patterns[i].charAt(j); // Get the current character

                    // Check if the current node has a child for the current character
                    if (curr.getChild().containsKey(c)) {
                        curr = curr.getChild().get(c); // Update the current node to the child node

Review comment (suggestion):
```suggestion
    public static class Trie {

```

Code after:

        public Node getSuffixLink() {
            return suffixLink;
        }

        public void setSuffixLink(final Node suffixLink) {
            this.suffixLink = suffixLink;
        }

        public Node getOutputLink() {
            return outputLink;
        }

        public void setOutputLink(final Node outputLink) {
            this.outputLink = outputLink;
        }

        public int getPatternInd() {
            return patternInd;
        }

        public void setPatternInd(final int patternInd) {
            this.patternInd = patternInd;
        }
    }

    // Trie Class
    public static class Trie {

        private Node root = null; // Root node of the trie
        private final String[] patterns; // patterns according to which Trie is constructed

        public Trie(final String[] patterns) {
            root = new Node(); // Initialize the root of the trie
            this.patterns = patterns;
            buildTrie();
            buildSuffixAndOutputLinks();
        }

        // builds AhoCorasick Trie
        private void buildTrie() {

            // Loop through each input pattern and building Trie
            for (int i = 0; i < patterns.length; i++) {
                Node curr = root; // Start at the root of the trie for each pattern

                // Loop through each character in the current pattern
                for (int j = 0; j < patterns[i].length(); j++) {
                    char c = patterns[i].charAt(j); // Get the current character

                    // Check if the current node has a child for the current character