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

    r8910 r9371  
    66import java.util.Collection;
    77import java.util.List;
     8import java.util.Objects;
    89
    910import javax.swing.Icon;
     
    7576    @Override
    7677    public int hashCode() {
    77         final int prime = 31;
    78         int result = super.hashCode();
    79         result = prime * result + ((conflict == null) ? 0 : conflict.hashCode());
    80         result = prime * result + ((mergedNodeList == null) ? 0 : mergedNodeList.hashCode());
    81         return result;
     78        return Objects.hash(super.hashCode(), conflict, mergedNodeList);
    8279    }
    8380
    8481    @Override
    8582    public boolean equals(Object obj) {
    86         if (this == obj)
    87             return true;
    88         if (!super.equals(obj))
    89             return false;
    90         if (getClass() != obj.getClass())
    91             return false;
    92         WayNodesConflictResolverCommand other = (WayNodesConflictResolverCommand) obj;
    93         if (conflict == null) {
    94             if (other.conflict != null)
    95                 return false;
    96         } else if (!conflict.equals(other.conflict))
    97             return false;
    98         if (mergedNodeList == null) {
    99             if (other.mergedNodeList != null)
    100                 return false;
    101         } else if (!mergedNodeList.equals(other.mergedNodeList))
    102             return false;
    103         return true;
     83        if (this == obj) return true;
     84        if (obj == null || getClass() != obj.getClass()) return false;
     85        if (!super.equals(obj)) return false;
     86        WayNodesConflictResolverCommand that = (WayNodesConflictResolverCommand) obj;
     87        return Objects.equals(conflict, that.conflict) &&
     88                Objects.equals(mergedNodeList, that.mergedNodeList);
    10489    }
    10590}
Note: See TracChangeset for help on using the changeset viewer.