Skip to content

Commit 59238d7

Browse files
author
Justin Wetherell
committed
Improved the XYZPoint equals method.
1 parent 21ba12a commit 59238d7

File tree

1 file changed

+7
-1
lines changed
  • src/com/jwetherell/algorithms/data_structures

1 file changed

+7
-1
lines changed

src/com/jwetherell/algorithms/data_structures/KdTree.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,13 @@ public boolean equals(Object obj) {
652652
return false;
653653

654654
XYZPoint xyzPoint = (XYZPoint) obj;
655-
return compareTo(xyzPoint) == 0;
655+
if (Double.compare(this.x, xyzPoint.x)!=0)
656+
return false;
657+
if (Double.compare(this.y, xyzPoint.y)!=0)
658+
return false;
659+
if (Double.compare(this.z, xyzPoint.z)!=0)
660+
return false;
661+
return true;
656662
}
657663

658664
/**

0 commit comments

Comments
 (0)