mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-06 00:54:32 +08:00
refactor: simplify logic of Point::equals
in KDTree
(#5158)
This commit is contained in:

committed by
GitHub

parent
5703be5953
commit
bbef89c885
@ -75,7 +75,6 @@ public class KDTree {
|
|||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof Point other) {
|
if (obj instanceof Point other) {
|
||||||
if (other.getDimension() != this.getDimension()) return false;
|
|
||||||
return Arrays.equals(other.coordinates, this.coordinates);
|
return Arrays.equals(other.coordinates, this.coordinates);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user