Ignore:
Timestamp:
2016-01-10T00:40:31+01:00 (8 years ago)
Author:
simon04
Message:

Java 7: use Objects.equals and Objects.hash (fixup r9371)

Location:
trunk/src/org/openstreetmap/josm/data/coor
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/coor/Coordinate.java

    r9372 r9375  
    33
    44import java.io.Serializable;
     5import java.util.Objects;
    56
    67import org.openstreetmap.josm.data.osm.BBox;
     
    113114    }
    114115
     116    @Override
     117    public int hashCode() {
     118        return Objects.hash(x, y);
     119    }
     120
     121    @Override
     122    public boolean equals(Object obj) {
     123        if (this == obj) return true;
     124        if (obj == null || getClass() != obj.getClass()) return false;
     125        Coordinate that = (Coordinate) obj;
     126        return Double.compare(that.x, x) == 0 &&
     127                Double.compare(that.y, y) == 0;
     128    }
    115129}
  • trunk/src/org/openstreetmap/josm/data/coor/LatLon.java

    r9371 r9375  
    429429    @Override
    430430    public int hashCode() {
    431         return Objects.hash(super.hashCode());
     431        return Objects.hash(x, y);
    432432    }
    433433
     
    436436        if (this == obj) return true;
    437437        if (obj == null || getClass() != obj.getClass()) return false;
    438         return super.equals(obj);
     438        LatLon that = (LatLon) obj;
     439        return Double.compare(that.x, x) == 0 &&
     440                Double.compare(that.y, y) == 0;
    439441    }
    440442
Note: See TracChangeset for help on using the changeset viewer.