Skip to content

Commit ab904e9

Browse files
committed
fix solution accorcing to exercises
1 parent d0c05b9 commit ab904e9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Coordinate.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ public double getDistanceToOriginPoint() {
2121
}
2222

2323
public int compareTo(Coordinate c) {
24-
return Double.valueOf(this.getDistanceToOriginPoint()).compareTo(c.getDistanceToOriginPoint());
24+
if (getDistanceToOriginPoint() < c.getDistanceToOriginPoint()) {
25+
return 1;
26+
} else if (getDistanceToOriginPoint() > c.getDistanceToOriginPoint()) {
27+
return -1;
28+
} else {
29+
return 0;
30+
}
2531
}
2632
}

0 commit comments

Comments
 (0)