Skip to content
Snippets Groups Projects
Commit d2eef3af authored by Eleanor McMurtry's avatar Eleanor McMurtry
Browse files

Merge branch 'hashcode' into 'master'

Point: Implement hashCode

See merge request !1
parents b16e211a 5e3a64fc
No related branches found
No related tags found
No related merge requests found
package bagel.util;
import java.util.Objects;
/**
* Immutable class that represents a 2D point in space.
*/
......@@ -42,6 +44,11 @@ public class Point {
}
}
@Override
public int hashCode() {
return Objects.hash(x, y);
}
public double distanceTo(Point b) {
return asVector().sub(b.asVector()).length();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment