(Point other)
| 5 | public record Point(int x, int y) implements Comparable<Point> { |
| 6 | |
| 7 | @Override |
| 8 | public int compareTo(Point other) { |
| 9 | int cmpY = Integer.compare(this.y, other.y); |
| 10 | return cmpY != 0 ? cmpY : Integer.compare(this.x, other.x); |
| 11 | } |
| 12 | |
| 13 | @Override |
| 14 | public String toString() { |