implements equals and hashcode for coordinate
@@ -20,4 +20,24 @@ public class Coordinate {
public float getLatitude() {
return latitude;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Coordinate that = (Coordinate) o;
+
+ if (Float.compare(that.latitude, latitude) != 0) return false;
+ if (Float.compare(that.longitude, longitude) != 0) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = (latitude != +0.0f ? Float.floatToIntBits(latitude) : 0);
+ result = 31 * result + (longitude != +0.0f ? Float.floatToIntBits(longitude) : 0);
+ return result;
+ }
}
