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/conflict/TagConflictResolveCommand.java

    r8910 r9371  
    66import java.util.Collection;
    77import java.util.List;
     8import java.util.Objects;
    89
    910import javax.swing.Icon;
     
    103104    @Override
    104105    public int hashCode() {
    105         final int prime = 31;
    106         int result = super.hashCode();
    107         result = prime * result + ((conflict == null) ? 0 : conflict.hashCode());
    108         result = prime * result + ((mergeItems == null) ? 0 : mergeItems.hashCode());
    109         return result;
     106        return Objects.hash(super.hashCode(), conflict, mergeItems);
    110107    }
    111108
    112109    @Override
    113110    public boolean equals(Object obj) {
    114         if (this == obj)
    115             return true;
    116         if (!super.equals(obj))
    117             return false;
    118         if (getClass() != obj.getClass())
    119             return false;
    120         TagConflictResolveCommand other = (TagConflictResolveCommand) obj;
    121         if (conflict == null) {
    122             if (other.conflict != null)
    123                 return false;
    124         } else if (!conflict.equals(other.conflict))
    125             return false;
    126         if (mergeItems == null) {
    127             if (other.mergeItems != null)
    128                 return false;
    129         } else if (!mergeItems.equals(other.mergeItems))
    130             return false;
    131         return true;
     111        if (this == obj) return true;
     112        if (obj == null || getClass() != obj.getClass()) return false;
     113        if (!super.equals(obj)) return false;
     114        TagConflictResolveCommand that = (TagConflictResolveCommand) obj;
     115        return Objects.equals(conflict, that.conflict) &&
     116                Objects.equals(mergeItems, that.mergeItems);
    132117    }
    133118}
Note: See TracChangeset for help on using the changeset viewer.