summaryrefslogtreecommitdiffstats
path: root/Algorithms/Part-I/3-Collinear/Point.java
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2013-03-11 23:06:37 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2013-11-15 17:38:44 +0100
commitf2c6973ed74702e7a7434cdc2630be3d8ba87b59 (patch)
tree436c8d29dafe2f2ead4b72284d591c1b52dec2a2 /Algorithms/Part-I/3-Collinear/Point.java
parentec3365b10f7cc8d07926ba8377212f1793e26ba7 (diff)
downloadcoursera-f2c6973ed74702e7a7434cdc2630be3d8ba87b59.zip
coursera-f2c6973ed74702e7a7434cdc2630be3d8ba87b59.tar.gz
Algorithms-I : 3-Collinear: speed and sub segments fixed
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;