@Test public void testHashCode() { Vector2D vector1 = new Vector2D(10, 10); Vector2D vector2 = new Vector2D(vector1); int hash1 = vector1.hashCode(); int hash2 = vector2.hashCode(); Assert.assertEquals(hash2, hash1); }
@Override public int hashCode() { int result; long temp; temp = Double.doubleToLongBits(xCoordinate); result = (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(yCoordinate); result = 31 * result + (int) (temp ^ (temp >>> 32)); return result; }
Vector2D { @Override public int hashCode() { int result; long temp; temp = Double.doubleToLongBits(xCoordinate); result = (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(yCoordinate); result = 31 * result + (int) (temp ^ (temp >>> 32)); return result; } }
Vector2D { @Override public int hashCode() { int result; long temp; temp = Double.doubleToLongBits(xCoordinate); result = (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(yCoordinate); result = 31 * result + (int) (temp ^ (temp >>> 32)); return result; } Vector2D(Vector2D vector2D);  Vector2D(double x, double y); }
Vector2D { @Override public int hashCode() { int result; long temp; temp = Double.doubleToLongBits(xCoordinate); result = (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(yCoordinate); result = 31 * result + (int) (temp ^ (temp >>> 32)); return result; } 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 int hashCode() { int result; long temp; temp = Double.doubleToLongBits(xCoordinate); result = (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(yCoordinate); result = 31 * result + (int) (temp ^ (temp >>> 32)); return result; } 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; }