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

Code before:
        private Node outputLink; // Output link to another node in the trie
        private int patternInd; // Index of the pattern that ends at this node

        Node() {
            this.suffixLink = null;
            this.outputLink = null;
            this.patternInd = -1;
        }

        public HashMap<Character, Node> getChild() {
            return child;
        }

        public Node getSuffixLink() {
            return suffixLink;
        }

        public void setSuffixLink(Node suffixLink) {
            this.suffixLink = suffixLink;
        }

        public Node getOutputLink() {
            return outputLink;
        }

        public void setOutputLink(Node outputLink) {
            this.outputLink = outputLink;
        }

        public int getPatternInd() {
            return patternInd;
        }

        public void setPatternInd(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 Node getTrieRoot() {
            return root;
        }

        public Trie(String[] patterns) {
            root = new Node(); // Initialize the root of the trie
            this.patterns = patterns;

Review comment (suggestion):
```suggestion
        public void setOutputLink(final Node outputLink) {

```

Code after:
        private HashMap<Character, Node> child = new HashMap<>(); // Child nodes of the current node
        private Node suffixLink; // Suffix link to another node in the trie
        private Node outputLink; // Output link to another node in the trie
        private int patternInd; // Index of the pattern that ends at this node

        Node() {
            this.suffixLink = null;
            this.outputLink = null;
            this.patternInd = -1;
        }

        public HashMap<Character, Node> getChild() {
            return child;
        }

        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();