Ignore:
Timestamp:
2016-01-09T23:20:37+01:00 (9 years ago)
Author:
simon04
Message:

Java 7: use Objects.equals and Objects.hash

File:
1 edited

Legend:

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

    r7509 r9371  
    33
    44import java.io.Serializable;
     5import java.util.Objects;
    56
    67import org.openstreetmap.josm.data.osm.BBox;
     
    113114    }
    114115
    115     protected final int computeHashCode(int init) {
    116         final int prime = 31;
    117         int result = init;
    118         long temp;
    119         temp = java.lang.Double.doubleToLongBits(x);
    120         result = prime * result + (int) (temp ^ (temp >>> 32));
    121         temp = java.lang.Double.doubleToLongBits(y);
    122         result = prime * result + (int) (temp ^ (temp >>> 32));
    123         return result;
    124     }
    125 
    126     @Override
    127     public int hashCode() {
    128         return computeHashCode(1);
    129     }
    130 
    131     @Override
    132     public boolean equals(Object obj) {
    133         if (this == obj)
    134             return true;
    135         if (obj == null || getClass() != obj.getClass())
    136             return false;
    137         Coordinate other = (Coordinate) obj;
    138         if (java.lang.Double.doubleToLongBits(x) != java.lang.Double.doubleToLongBits(other.x))
    139             return false;
    140         if (java.lang.Double.doubleToLongBits(y) != java.lang.Double.doubleToLongBits(other.y))
    141             return false;
    142         return true;
    143     }
    144116}
Note: See TracChangeset for help on using the changeset viewer.