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/command/PurgeCommand.java

    r9243 r9371  
    1111import java.util.List;
    1212import java.util.Map;
     13import java.util.Objects;
    1314import java.util.Set;
    1415
     
    279280    @Override
    280281    public int hashCode() {
    281         final int prime = 31;
    282         int result = super.hashCode();
    283         result = prime * result + ((ds == null) ? 0 : ds.hashCode());
    284         result = prime * result + ((makeIncompleteData == null) ? 0 : makeIncompleteData.hashCode());
    285         result = prime * result + ((makeIncompleteDataByPrimId == null) ? 0 : makeIncompleteDataByPrimId.hashCode());
    286         result = prime * result + ((purgedConflicts == null) ? 0 : purgedConflicts.hashCode());
    287         result = prime * result + ((toPurge == null) ? 0 : toPurge.hashCode());
    288         return result;
     282        return Objects.hash(super.hashCode(), toPurge, makeIncompleteData, makeIncompleteDataByPrimId, purgedConflicts, ds);
    289283    }
    290284
    291285    @Override
    292286    public boolean equals(Object obj) {
    293         if (this == obj)
    294             return true;
    295         if (!super.equals(obj))
    296             return false;
    297         if (getClass() != obj.getClass())
    298             return false;
    299         PurgeCommand other = (PurgeCommand) obj;
    300         if (ds == null) {
    301             if (other.ds != null)
    302                 return false;
    303         } else if (!ds.equals(other.ds))
    304             return false;
    305         if (makeIncompleteData == null) {
    306             if (other.makeIncompleteData != null)
    307                 return false;
    308         } else if (!makeIncompleteData.equals(other.makeIncompleteData))
    309             return false;
    310         if (makeIncompleteDataByPrimId == null) {
    311             if (other.makeIncompleteDataByPrimId != null)
    312                 return false;
    313         } else if (!makeIncompleteDataByPrimId.equals(other.makeIncompleteDataByPrimId))
    314             return false;
    315         if (purgedConflicts == null) {
    316             if (other.purgedConflicts != null)
    317                 return false;
    318         } else if (!purgedConflicts.equals(other.purgedConflicts))
    319             return false;
    320         if (toPurge == null) {
    321             if (other.toPurge != null)
    322                 return false;
    323         } else if (!toPurge.equals(other.toPurge))
    324             return false;
    325         return true;
     287        if (this == obj) return true;
     288        if (obj == null || getClass() != obj.getClass()) return false;
     289        if (!super.equals(obj)) return false;
     290        PurgeCommand that = (PurgeCommand) obj;
     291        return Objects.equals(toPurge, that.toPurge) &&
     292                Objects.equals(makeIncompleteData, that.makeIncompleteData) &&
     293                Objects.equals(makeIncompleteDataByPrimId, that.makeIncompleteDataByPrimId) &&
     294                Objects.equals(purgedConflicts, that.purgedConflicts) &&
     295                Objects.equals(ds, that.ds);
    326296    }
    327297}
Note: See TracChangeset for help on using the changeset viewer.