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/gui/mappaint/DividedScale.java

    r9341 r9371  
    44import java.util.ArrayList;
    55import java.util.List;
     6import java.util.Objects;
    67
    78import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement;
     
    176177    @Override
    177178    public boolean equals(Object obj) {
    178         if (obj == null || getClass() != obj.getClass())
    179             return false;
    180         final DividedScale other = (DividedScale) obj;
    181         return bd.equals(other.bd) && data.equals(other.data);
     179        if (this == obj) return true;
     180        if (obj == null || getClass() != obj.getClass()) return false;
     181        DividedScale<?> that = (DividedScale<?>) obj;
     182        return Objects.equals(bd, that.bd) &&
     183                Objects.equals(data, that.data);
    182184    }
    183185
    184186    @Override
    185187    public int hashCode() {
    186         int hash = 7;
    187         hash = 23 * hash + bd.hashCode();
    188         hash = 23 * hash + data.hashCode();
    189         return hash;
     188        return Objects.hash(bd, data);
    190189    }
    191190
Note: See TracChangeset for help on using the changeset viewer.