25.19 Line with Most Points


#1
  1. The Rational class seems to be missing an equals() method definition, which is being used in the equals method of Line.

  2. I don’t understand this code:
    Set s1 = table.get(l);
    if (s1 == null) {
    s1 = new HashSet<>();
    table.put(l, s1);
    }
    s1.add(P.get(i));

     Set<Point> s2 = table.get(l);
     if (s2 == null) {
       s2 = new HashSet<>();
       table.put(l, s2);
     }
    

s2.add(P.get(j));

Why are two sets getting created? Don’t we just need one and add both points to it?