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/actions/search/SearchAction.java

    r9079 r9371  
    2424import java.util.List;
    2525import java.util.Map;
     26import java.util.Objects;
    2627import java.util.Set;
    2728
     
    677678        @Override
    678679        public boolean equals(Object other) {
    679             if (!(other instanceof SearchSetting))
    680                 return false;
    681             SearchSetting o = (SearchSetting) other;
    682             return o.caseSensitive == this.caseSensitive
    683                     && o.regexSearch == this.regexSearch
    684                     && o.mapCSSSearch == this.mapCSSSearch
    685                     && o.allElements == this.allElements
    686                     && o.mode.equals(this.mode)
    687                     && o.text.equals(this.text);
     680            if (this == other) return true;
     681            if (other == null || getClass() != other.getClass()) return false;
     682            SearchSetting that = (SearchSetting) other;
     683            return caseSensitive == that.caseSensitive &&
     684                    regexSearch == that.regexSearch &&
     685                    mapCSSSearch == that.mapCSSSearch &&
     686                    allElements == that.allElements &&
     687                    Objects.equals(text, that.text) &&
     688                    mode == that.mode;
    688689        }
    689690
    690691        @Override
    691692        public int hashCode() {
    692             return text.hashCode();
     693            return Objects.hash(text, mode, caseSensitive, regexSearch, mapCSSSearch, allElements);
    693694        }
    694695
Note: See TracChangeset for help on using the changeset viewer.