Changeset 30478 in osm for applications/viewer


Ignore:
Timestamp:
2014-05-29T08:49:02+02:00 (10 years ago)
Author:
bastik
Message:

see #josm9914 - add equals & hashcode for Coordinate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Coordinate.java

    r30223 r30478  
    77import java.io.ObjectOutputStream;
    88import java.io.Serializable;
     9import java.util.Objects;
    910
    1011import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate;
     
    5455        return "Coordinate[" + data.y + ", " + data.x + "]";
    5556    }
     57
     58    @Override
     59    public int hashCode() {
     60        int hash = 3;
     61        hash = 61 * hash + Objects.hashCode(this.data);
     62        return hash;
     63    }
     64
     65    @Override
     66    public boolean equals(Object obj) {
     67        if (obj == null) {
     68            return false;
     69        }
     70        if (getClass() != obj.getClass()) {
     71            return false;
     72        }
     73        final Coordinate other = (Coordinate) obj;
     74        if (!Objects.equals(this.data, other.data)) {
     75            return false;
     76        }
     77        return true;
     78    }
     79   
     80   
    5681}
Note: See TracChangeset for help on using the changeset viewer.