diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2014-04-02 00:32:16 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2014-04-02 00:32:16 +0200 |
| commit | b674157bf100ee5d1616b104f49a26631c9ba1f6 (patch) | |
| tree | 7c7facd8c829276d925bd2df0b709ded7a3556cf /main/src | |
| parent | 6422ccae65dbf47d53f18c3501e4a295dcdaf751 (diff) | |
| parent | a045c6edaebe4200835aeffcea977fc8245b6ad1 (diff) | |
| download | cgeo-b674157bf100ee5d1616b104f49a26631c9ba1f6.zip cgeo-b674157bf100ee5d1616b104f49a26631c9ba1f6.tar.gz cgeo-b674157bf100ee5d1616b104f49a26631c9ba1f6.tar.bz2 | |
Merge branch 'release' into upstream
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/Geocache.java | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index a03f515..a224e4e 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -1414,19 +1414,14 @@ public class Geocache implements ICache, IWaypoint { @Override public int hashCode() { - return geocode.hashCode() * name.hashCode(); + return StringUtils.defaultString(geocode).hashCode(); } @Override public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof Geocache)) { - return false; - } + // TODO: explain the following line or remove this non-standard equality method // just compare the geocode even if that is not what "equals" normally does - return StringUtils.isNotBlank(geocode) && geocode.equals(((Geocache) obj).geocode); + return this == obj || (obj instanceof Geocache && StringUtils.isNotEmpty(geocode) && geocode.equals(((Geocache) obj).geocode)); } public void store(CancellableHandler handler) { |
