Skip to content

Commit 2cbe9d8

Browse files
fix: added hashcode guava google in geolocation
1 parent 802e622 commit 2cbe9d8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dependencies {
1717
// compile 'org.apache.httpcomponents:httpclient:4.5.2'
1818
compile 'com.squareup.okhttp3:okhttp:3.12.0'
1919
compile group: 'com.google.code.gson', name: 'gson', version: '2.7'
20+
implementation 'com.google.guava:guava:28.1-jre'
2021

2122
testCompile group: 'junit', name: 'junit', version: '4.12'
2223
}

src/main/java/com/osrm/client/GeoLocation.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.osrm.client;
22

3+
import com.google.common.base.Objects;
4+
35
public class GeoLocation {
46
private final Double latitude;
57
private final Double longitude;
@@ -23,7 +25,7 @@ public String getLatLongString() {
2325

2426
@Override
2527
public int hashCode() {
26-
return latitude.hashCode() + longitude.hashCode();
28+
return Objects.hashCode(this.getLatitude(), this.getLongitude());
2729
}
2830

2931
@Override

0 commit comments

Comments
 (0)