summaryrefslogtreecommitdiffstats
path: root/Algorithms/Part-I/3-Collinear/Point.java
diff options
context:
space:
mode:
Diffstat (limited to 'Algorithms/Part-I/3-Collinear/Point.java')
-rw-r--r--Algorithms/Part-I/3-Collinear/Point.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/Algorithms/Part-I/3-Collinear/Point.java b/Algorithms/Part-I/3-Collinear/Point.java
index bd5bbe7..1dddb53 100644
--- a/Algorithms/Part-I/3-Collinear/Point.java
+++ b/Algorithms/Part-I/3-Collinear/Point.java
@@ -67,6 +67,7 @@ public class Point implements Comparable<Point> {
// is this point lexicographically smaller than that one?
// comparing y-coordinates and breaking ties by x-coordinates
public int compareTo(Point that) {
+ if (this == that) return 0;
if (this.y < that.y) return -1;
if (this.y > that.y) return 1;
if (this.x < that.x) return -1;