Ignore:
Timestamp:
2016-01-09T23:20:37+01:00 (8 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/osm/SimplePrimitiveId.java

    r8496 r9371  
    55import java.util.ArrayList;
    66import java.util.List;
     7import java.util.Objects;
    78import java.util.regex.MatchResult;
    89import java.util.regex.Matcher;
     
    4243    @Override
    4344    public int hashCode() {
    44         final int prime = 31;
    45         int result = 1;
    46         result = prime * result + (int) (id ^ (id >>> 32));
    47         result = prime * result + ((type == null) ? 0 : type.hashCode());
    48         return result;
     45        return Objects.hash(id, type);
    4946    }
    5047
    5148    @Override
    5249    public boolean equals(Object obj) {
    53         if (this == obj)
    54             return true;
    55         if (obj == null)
    56             return false;
    57         if (getClass() != obj.getClass())
    58             return false;
    59         SimplePrimitiveId other = (SimplePrimitiveId) obj;
    60         if (id != other.id)
    61             return false;
    62         if (type == null) {
    63             if (other.type != null)
    64                 return false;
    65         } else if (!type.equals(other.type))
    66             return false;
    67         return true;
     50        if (this == obj) return true;
     51        if (obj == null || getClass() != obj.getClass()) return false;
     52        SimplePrimitiveId that = (SimplePrimitiveId) obj;
     53        return id == that.id &&
     54                type == that.type;
    6855    }
    6956
Note: See TracChangeset for help on using the changeset viewer.