Below code returns false. Trying to make Equation object act as a key in a custom HashMap. Pretty sure method overrides are implemented correctly, hashCode is the exact same between the two equation instances. What is exactly wrong?
class Solution {
    public boolean maxPoints(int[][] points) {
        Map<Equation, Integer> map = new HashMap<>();
        Equation eq1 = new Equation(1, 2);
        Equation eq2 = new Equation(1, 2);
        map.put(eq1, 1);
        if (map.containsKey(eq1)) return true;
        return false;
    }
    
    class Equation {
        private int slope;
        private int yIntercept;
        public Equation(int slope, int yIntercept) {
            this.slope = slope;
            this.yIntercept = yIntercept;
        }
        
        public boolean equals(Equation other) {
            if (other == this) return true;
            return (this.slope == other.slope && this.yIntercept == other.yIntercept);
        }
        
        public int hashCode() {
            return Objects.hash(this.slope, this.yIntercept);
        }
    }
}
 
     
    