Ignore:
Timestamp:
2016-01-09T23:20:37+01:00 (9 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/data/Preferences.java

    r9312 r9371  
    228228        @Override
    229229        public int hashCode() {
    230             final int prime = 31;
    231             int result = 1;
    232             result = prime * result + ((value == null) ? 0 : value.hashCode());
    233             return result;
     230            return Objects.hash(value);
    234231        }
    235232
    236233        @Override
    237234        public boolean equals(Object obj) {
    238             if (this == obj)
    239                 return true;
    240             if (obj == null)
    241                 return false;
    242             if (!(obj instanceof AbstractSetting))
    243                 return false;
    244             AbstractSetting<?> other = (AbstractSetting<?>) obj;
    245             if (value == null) {
    246                 if (other.value != null)
    247                     return false;
    248             } else if (!value.equals(other.value))
    249                 return false;
    250             return true;
     235            if (this == obj) return true;
     236            if (obj == null || getClass() != obj.getClass()) return false;
     237            AbstractSetting<?> that = (AbstractSetting<?>) obj;
     238            return Objects.equals(value, that.value);
    251239        }
    252240    }
Note: See TracChangeset for help on using the changeset viewer.