@Test public void testEqualsNonVector() { Vector2D vector1 = new Vector2D(10, 10); String foo = "bar"; Assert.assertFalse(vector1.equals(foo)); }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Vector2D)) return false; Vector2D vector2D = (Vector2D) o; return Double.compare(vector2D.xCoordinate, xCoordinate) == 0 && Double.compare(vector2D.yCoordinate, yCoordinate) == 0; }
Vector2D { @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Vector2D)) return false; Vector2D vector2D = (Vector2D) o; return Double.compare(vector2D.xCoordinate, xCoordinate) == 0 && Double.compare(vector2D.yCoordinate, yCoordinate) == 0; } }
Vector2D { @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Vector2D)) return false; Vector2D vector2D = (Vector2D) o; return Double.compare(vector2D.xCoordinate, xCoordinate) == 0 && Double.compare(vector2D.yCoordinate, yCoordinate) == 0; } Vector2D(Vector2D vector2D);  Vector2D(double x, double y); }
Vector2D { @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Vector2D)) return false; Vector2D vector2D = (Vector2D) o; return Double.compare(vector2D.xCoordinate, xCoordinate) == 0 && Double.compare(vector2D.yCoordinate, yCoordinate) == 0; } Vector2D(Vector2D vector2D);  Vector2D(double x, double y); @Override boolean equals(Object o); @Override int hashCode(); double getYCoordinate(); double getXCoordinate(); @Override String toString(); Vector2D getVectorInDirection(double distance, double angle); double getAngleToVector(Vector2D vector2D); double getDistanceToVector(Vector2D vector2D); double getSquaredDistanceToVector(Vector2D vector2D); }
Vector2D { @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Vector2D)) return false; Vector2D vector2D = (Vector2D) o; return Double.compare(vector2D.xCoordinate, xCoordinate) == 0 && Double.compare(vector2D.yCoordinate, yCoordinate) == 0; } Vector2D(Vector2D vector2D);  Vector2D(double x, double y); @Override boolean equals(Object o); @Override int hashCode(); double getYCoordinate(); double getXCoordinate(); @Override String toString(); Vector2D getVectorInDirection(double distance, double angle); double getAngleToVector(Vector2D vector2D); double getDistanceToVector(Vector2D vector2D); double getSquaredDistanceToVector(Vector2D vector2D); static final Vector2D ORIGIN; }