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/DeletedStateConflictResolveCommand.java

    r8910 r9371  
    55
    66import java.util.Collection;
     7import java.util.Objects;
    78import java.util.Set;
    89
     
    9192    @Override
    9293    public int hashCode() {
    93         final int prime = 31;
    94         int result = super.hashCode();
    95         result = prime * result + ((conflict == null) ? 0 : conflict.hashCode());
    96         result = prime * result + ((decision == null) ? 0 : decision.hashCode());
    97         return result;
     94        return Objects.hash(super.hashCode(), conflict, decision);
    9895    }
    9996
    10097    @Override
    10198    public boolean equals(Object obj) {
    102         if (this == obj)
    103             return true;
    104         if (!super.equals(obj))
    105             return false;
    106         if (getClass() != obj.getClass())
    107             return false;
    108         DeletedStateConflictResolveCommand other = (DeletedStateConflictResolveCommand) obj;
    109         if (conflict == null) {
    110             if (other.conflict != null)
    111                 return false;
    112         } else if (!conflict.equals(other.conflict))
    113             return false;
    114         if (decision != other.decision)
    115             return false;
    116         return true;
     99        if (this == obj) return true;
     100        if (obj == null || getClass() != obj.getClass()) return false;
     101        if (!super.equals(obj)) return false;
     102        DeletedStateConflictResolveCommand that = (DeletedStateConflictResolveCommand) obj;
     103        return Objects.equals(conflict, that.conflict) &&
     104                decision == that.decision;
    117105    }
    118106}
Note: See TracChangeset for help on using the changeset viewer.