commit b0efa87799acf7e913671846ec74f3fc41fefc4f
Author: Simon Legner <Simon.Legner@gmail.com>
Date:   2020-03-15 16:11:25 +0100

    xxx

diff --git a/src/org/openstreetmap/josm/data/gpx/GpxRoute.java b/src/org/openstreetmap/josm/data/gpx/GpxRoute.java
index 543f0590a..b519eab4c 100644
--- a/src/org/openstreetmap/josm/data/gpx/GpxRoute.java
+++ b/src/org/openstreetmap/josm/data/gpx/GpxRoute.java
@@ -3,6 +3,7 @@
 
 import java.util.Collection;
 import java.util.LinkedList;
+import java.util.Objects;
 
 /**
  * A route is a part of a GPX file containing of multiple GPX points.
@@ -17,7 +18,7 @@
 
     @Override
     public int hashCode() {
-        return 31 * super.hashCode() + ((routePoints == null) ? 0 : routePoints.hashCode());
+        return Objects.hash(super.hashCode(), routePoints);
     }
 
     @Override
@@ -29,11 +30,6 @@ public boolean equals(Object obj) {
         if (getClass() != obj.getClass())
             return false;
         GpxRoute other = (GpxRoute) obj;
-        if (routePoints == null) {
-            if (other.routePoints != null)
-                return false;
-        } else if (!routePoints.equals(other.routePoints))
-            return false;
-        return true;
+        return Objects.equals(routePoints, other.routePoints);
     }
 }
diff --git a/src/org/openstreetmap/josm/data/gpx/GpxTrack.java b/src/org/openstreetmap/josm/data/gpx/GpxTrack.java
index f78adc63b..d29c82793 100644
--- a/src/org/openstreetmap/josm/data/gpx/GpxTrack.java
+++ b/src/org/openstreetmap/josm/data/gpx/GpxTrack.java
@@ -9,6 +9,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Objects;
 import java.util.Optional;
 
 import org.openstreetmap.josm.data.Bounds;
@@ -211,7 +212,7 @@ public double length() {
 
     @Override
     public int hashCode() {
-        return 31 * super.hashCode() + ((segments == null) ? 0 : segments.hashCode());
+        return Objects.hash(segments);
     }
 
     @Override
@@ -225,12 +226,7 @@ public boolean equals(Object obj) {
         if (getClass() != obj.getClass())
             return false;
         GpxTrack other = (GpxTrack) obj;
-        if (segments == null) {
-            if (other.segments != null)
-                return false;
-        } else if (!segments.equals(other.segments))
-            return false;
-        return true;
+        return Objects.equals(segments, other.segments);
     }
 
     @Override
diff --git a/src/org/openstreetmap/josm/data/gpx/GpxTrackSegment.java b/src/org/openstreetmap/josm/data/gpx/GpxTrackSegment.java
index 87cb2e90f..9cfd0ec0e 100644
--- a/src/org/openstreetmap/josm/data/gpx/GpxTrackSegment.java
+++ b/src/org/openstreetmap/josm/data/gpx/GpxTrackSegment.java
@@ -5,6 +5,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Objects;
 
 import org.openstreetmap.josm.data.Bounds;
 
@@ -77,10 +78,7 @@ public int getUpdateCount() {
 
     @Override
     public int hashCode() {
-        final int prime = 31;
-        int result = prime + super.hashCode();
-        result = prime * result + ((wayPoints == null) ? 0 : wayPoints.hashCode());
-        return result;
+        return Objects.hash(super.hashCode(), wayPoints);
     }
 
     @Override
@@ -94,11 +92,6 @@ public boolean equals(Object obj) {
         if (getClass() != obj.getClass())
             return false;
         GpxTrackSegment other = (GpxTrackSegment) obj;
-        if (wayPoints == null) {
-            if (other.wayPoints != null)
-                return false;
-        } else if (!wayPoints.equals(other.wayPoints))
-            return false;
-        return true;
+        return Objects.equals(wayPoints, other.wayPoints);
     }
 }
diff --git a/src/org/openstreetmap/josm/data/preferences/AbstractProperty.java b/src/org/openstreetmap/josm/data/preferences/AbstractProperty.java
index 07a10e0c9..4453e979a 100644
--- a/src/org/openstreetmap/josm/data/preferences/AbstractProperty.java
+++ b/src/org/openstreetmap/josm/data/preferences/AbstractProperty.java
@@ -1,6 +1,8 @@
 // License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.data.preferences;
 
+import java.util.Objects;
+
 import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.spi.preferences.IPreferences;
 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
@@ -28,11 +30,7 @@ public void preferenceChanged(PreferenceChangeEvent e) {
 
         @Override
         public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + getOuterType().hashCode();
-            result = prime * result + ((listener == null) ? 0 : listener.hashCode());
-            return result;
+            return Objects.hash(getOuterType(), listener);
         }
 
         @Override
@@ -317,11 +315,7 @@ protected void removeListenerImpl(PreferenceChangedListener adapter) {
 
     @Override
     public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((key == null) ? 0 : key.hashCode());
-        result = prime * result + ((preferences == null) ? 0 : preferences.hashCode());
-        return result;
+        return Objects.hash(key, preferences);
     }
 
     @Override
@@ -331,16 +325,6 @@ public boolean equals(Object obj) {
         if (obj == null || getClass() != obj.getClass())
             return false;
         AbstractProperty<?> other = (AbstractProperty<?>) obj;
-        if (key == null) {
-            if (other.key != null)
-                return false;
-        } else if (!key.equals(other.key))
-            return false;
-        if (preferences == null) {
-            if (other.preferences != null)
-                return false;
-        } else if (!preferences.equals(other.preferences))
-            return false;
-        return true;
+        return Objects.equals(key, other.key) && Objects.equals(preferences, other.preferences);
     }
 }
diff --git a/src/org/openstreetmap/josm/data/tagging/ac/AutoCompletionItem.java b/src/org/openstreetmap/josm/data/tagging/ac/AutoCompletionItem.java
index 0430a6c88..f0918911c 100644
--- a/src/org/openstreetmap/josm/data/tagging/ac/AutoCompletionItem.java
+++ b/src/org/openstreetmap/josm/data/tagging/ac/AutoCompletionItem.java
@@ -1,6 +1,8 @@
 // License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.data.tagging.ac;
 
+import java.util.Objects;
+
 /**
  * Represents an entry in the set of auto completion values.
  *
@@ -85,12 +87,7 @@ public String toString() {
 
     @Override
     public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result
-                + ((priority == null) ? 0 : priority.hashCode());
-        result = prime * result + ((value == null) ? 0 : value.hashCode());
-        return result;
+        return Objects.hash(priority, value);
     }
 
     @Override
@@ -104,17 +101,7 @@ public boolean equals(Object obj) {
         if (getClass() != obj.getClass())
             return false;
         final AutoCompletionItem other = (AutoCompletionItem) obj;
-        if (priority == null) {
-            if (other.priority != null)
-                return false;
-        } else if (!priority.equals(other.priority))
-            return false;
-        if (value == null) {
-            if (other.value != null)
-                return false;
-        } else if (!value.equals(other.value))
-            return false;
-        return true;
+        return Objects.equals(priority, other.priority) && Objects.equals(value, other.value);
     }
 
     @Override
diff --git a/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java b/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java
index c7fa2f46b..29a37490b 100644
--- a/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java
+++ b/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java
@@ -76,7 +76,7 @@ public void loadThumbnail() {
 
     @Override
     public int hashCode() {
-        return 31 * super.hashCode() + ((thumbnail == null) ? 0 : thumbnail.hashCode());
+        return Objects.hash(thumbnail);
     }
 
     @Override
diff --git a/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaIconElement.java b/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaIconElement.java
index fb5fbf1ee..26900b503 100644
--- a/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaIconElement.java
+++ b/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaIconElement.java
@@ -71,12 +71,7 @@ public static AreaIconElement create(final Environment env) {
 
     @Override
     public int hashCode() {
-        final int prime = 31;
-        int result = super.hashCode();
-        result = prime * result + ((iconImage == null) ? 0 : iconImage.hashCode());
-        result = prime * result + ((iconImageAngle == null) ? 0 : iconImageAngle.hashCode());
-        result = prime * result + ((iconPosition == null) ? 0 : iconPosition.hashCode());
-        return result;
+        return Objects.hash(iconImage, iconImageAngle, iconPosition);
     }
 
     @Override
diff --git a/src/org/openstreetmap/josm/gui/mappaint/styleelement/placement/CompletelyInsideAreaStrategy.java b/src/org/openstreetmap/josm/gui/mappaint/styleelement/placement/CompletelyInsideAreaStrategy.java
index f1c8ccbab..dcbd712c0 100644
--- a/src/org/openstreetmap/josm/gui/mappaint/styleelement/placement/CompletelyInsideAreaStrategy.java
+++ b/src/org/openstreetmap/josm/gui/mappaint/styleelement/placement/CompletelyInsideAreaStrategy.java
@@ -4,6 +4,7 @@
 import java.awt.Rectangle;
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
+import java.util.Objects;
 
 import org.openstreetmap.josm.gui.MapViewState;
 import org.openstreetmap.josm.gui.draw.MapViewPath;
diff --git a/src/org/openstreetmap/josm/gui/preferences/advanced/PrefEntry.java b/src/org/openstreetmap/josm/gui/preferences/advanced/PrefEntry.java
index 2801fb3a8..406ec7d89 100644
--- a/src/org/openstreetmap/josm/gui/preferences/advanced/PrefEntry.java
+++ b/src/org/openstreetmap/josm/gui/preferences/advanced/PrefEntry.java
@@ -1,6 +1,8 @@
 // License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.gui.preferences.advanced;
 
+import java.util.Objects;
+
 import org.openstreetmap.josm.spi.preferences.Setting;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
 
@@ -105,7 +107,7 @@ public int compareTo(PrefEntry other) {
 
     @Override
     public int hashCode() {
-        return 31 + ((key == null) ? 0 : key.hashCode());
+        return Objects.hash(key);
     }
 
     @Override
@@ -115,12 +117,7 @@ public boolean equals(Object obj) {
         if (obj == null || getClass() != obj.getClass())
             return false;
         PrefEntry other = (PrefEntry) obj;
-        if (key == null) {
-            if (other.key != null)
-                return false;
-        } else if (!key.equals(other.key))
-            return false;
-        return true;
+        return Objects.equals(key, other.key);
     }
 
     @Override
diff --git a/src/org/openstreetmap/josm/plugins/PluginHandler.java b/src/org/openstreetmap/josm/plugins/PluginHandler.java
index 264e6f132..0941b81ea 100644
--- a/src/org/openstreetmap/josm/plugins/PluginHandler.java
+++ b/src/org/openstreetmap/josm/plugins/PluginHandler.java
@@ -32,6 +32,7 @@
 import java.util.Locale;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Objects;
 import java.util.Set;
 import java.util.TreeSet;
 import java.util.concurrent.ExecutionException;
@@ -222,9 +223,7 @@ public DeprecatedPlugin(String name, String reason) {
 
         @Override
         public int hashCode() {
-            final int prime = 31;
-            int result = prime + ((name == null) ? 0 : name.hashCode());
-            return prime * result + ((reason == null) ? 0 : reason.hashCode());
+            return Objects.hash(name, reason);
         }
 
         @Override
@@ -236,17 +235,7 @@ public boolean equals(Object obj) {
             if (getClass() != obj.getClass())
                 return false;
             DeprecatedPlugin other = (DeprecatedPlugin) obj;
-            if (name == null) {
-                if (other.name != null)
-                    return false;
-            } else if (!name.equals(other.name))
-                return false;
-            if (reason == null) {
-                if (other.reason != null)
-                    return false;
-            } else if (!reason.equals(other.reason))
-                return false;
-            return true;
+            return Objects.equals(name, other.name) && Objects.equals(reason, other.reason);
         }
 
         @Override
diff --git a/src/org/openstreetmap/josm/tools/ListenerList.java b/src/org/openstreetmap/josm/tools/ListenerList.java
index 6dce4ae1c..7df4bf551 100644
--- a/src/org/openstreetmap/josm/tools/ListenerList.java
+++ b/src/org/openstreetmap/josm/tools/ListenerList.java
@@ -49,12 +49,7 @@ public boolean equals(Object obj) {
 
         @Override
         public int hashCode() {
-            T l = listener.get();
-            if (l == null) {
-                return 0;
-            } else {
-                return l.hashCode();
-            }
+            return Objects.hash(listener.get());
         }
 
         @Override
diff --git a/src/org/openstreetmap/josm/tools/template_engine/CompoundTemplateEntry.java b/src/org/openstreetmap/josm/tools/template_engine/CompoundTemplateEntry.java
index 1f859ea2e..5afb49b31 100644
--- a/src/org/openstreetmap/josm/tools/template_engine/CompoundTemplateEntry.java
+++ b/src/org/openstreetmap/josm/tools/template_engine/CompoundTemplateEntry.java
@@ -2,6 +2,7 @@
 package org.openstreetmap.josm.tools.template_engine;
 
 import java.util.Arrays;
+import java.util.Objects;
 
 /**
  * {@link TemplateEntry} that concatenates several templates.
diff --git a/src/org/openstreetmap/josm/tools/template_engine/Condition.java b/src/org/openstreetmap/josm/tools/template_engine/Condition.java
index 8c0c8c05b..0bbab605b 100644
--- a/src/org/openstreetmap/josm/tools/template_engine/Condition.java
+++ b/src/org/openstreetmap/josm/tools/template_engine/Condition.java
@@ -4,6 +4,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * {@link TemplateEntry} that applies other templates based on conditions.
@@ -73,7 +74,7 @@ public String toString() {
 
     @Override
     public int hashCode() {
-        return 31 + ((entries == null) ? 0 : entries.hashCode());
+        return 31 + entries.hashCode();
     }
 
     @Override
@@ -83,11 +84,6 @@ public boolean equals(Object obj) {
         if (obj == null || getClass() != obj.getClass())
             return false;
         Condition other = (Condition) obj;
-        if (entries == null) {
-            if (other.entries != null)
-                return false;
-        } else if (!entries.equals(other.entries))
-            return false;
-        return true;
+        return Objects.equals(entries, other.entries);
     }
 }
diff --git a/src/org/openstreetmap/josm/tools/template_engine/ContextSwitchTemplate.java b/src/org/openstreetmap/josm/tools/template_engine/ContextSwitchTemplate.java
index 2ffe6d895..653958db3 100644
--- a/src/org/openstreetmap/josm/tools/template_engine/ContextSwitchTemplate.java
+++ b/src/org/openstreetmap/josm/tools/template_engine/ContextSwitchTemplate.java
@@ -7,6 +7,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Objects;
 
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -51,7 +52,7 @@ public boolean evaluateCondition(Match condition) {
 
         @Override
         public int hashCode() {
-            return 31 + ((condition == null) ? 0 : condition.hashCode());
+            return Objects.hash(condition);
         }
 
         @Override
@@ -61,12 +62,7 @@ public boolean equals(Object obj) {
             if (obj == null || getClass() != obj.getClass())
                 return false;
             ContextProvider other = (ContextProvider) obj;
-            if (condition == null) {
-                if (other.condition != null)
-                    return false;
-            } else if (!condition.equals(other.condition))
-                return false;
-            return true;
+            return Objects.equals(condition, other.condition);
         }
     }
 
@@ -106,7 +102,7 @@ public boolean match(OsmPrimitive osm) {
 
         @Override
         public int hashCode() {
-            return 31 * super.hashCode() + ((childCondition == null) ? 0 : childCondition.hashCode());
+            return Objects.hash(super.hashCode(), childCondition);
         }
 
         @Override
@@ -116,12 +112,7 @@ public boolean equals(Object obj) {
             if (!super.equals(obj) || getClass() != obj.getClass())
                 return false;
             ParentSet other = (ParentSet) obj;
-            if (childCondition == null) {
-                if (other.childCondition != null)
-                    return false;
-            } else if (!childCondition.equals(other.childCondition))
-                return false;
-            return true;
+            return Objects.equals(childCondition, other.childCondition);
         }
     }
 
@@ -169,7 +160,7 @@ public boolean match(OsmPrimitive osm) {
 
         @Override
         public int hashCode() {
-            return 31 * super.hashCode() + ((parentCondition == null) ? 0 : parentCondition.hashCode());
+            return Objects.hash(super.hashCode(), parentCondition);
         }
 
         @Override
@@ -179,12 +170,7 @@ public boolean equals(Object obj) {
             if (!super.equals(obj) || getClass() != obj.getClass())
                 return false;
             ChildSet other = (ChildSet) obj;
-            if (parentCondition == null) {
-                if (other.parentCondition != null)
-                    return false;
-            } else if (!parentCondition.equals(other.parentCondition))
-                return false;
-            return true;
+            return Objects.equals(parentCondition, other.parentCondition);
         }
     }
 
@@ -220,11 +206,7 @@ public boolean match(OsmPrimitive osm) {
 
         @Override
         public int hashCode() {
-            final int prime = 31;
-            int result = super.hashCode();
-            result = prime * result + ((lhs == null) ? 0 : lhs.hashCode());
-            result = prime * result + ((rhs == null) ? 0 : rhs.hashCode());
-            return result;
+            return Objects.hash(super.hashCode(), lhs, rhs);
         }
 
         @Override
@@ -234,17 +216,7 @@ public boolean equals(Object obj) {
             if (!super.equals(obj) || getClass() != obj.getClass())
                 return false;
             OrSet other = (OrSet) obj;
-            if (lhs == null) {
-                if (other.lhs != null)
-                    return false;
-            } else if (!lhs.equals(other.lhs))
-                return false;
-            if (rhs == null) {
-                if (other.rhs != null)
-                    return false;
-            } else if (!rhs.equals(other.rhs))
-                return false;
-            return true;
+            return Objects.equals(lhs, other.lhs) && Objects.equals(rhs, other.rhs);
         }
     }
 
@@ -276,11 +248,7 @@ public boolean match(OsmPrimitive osm) {
 
         @Override
         public int hashCode() {
-            final int prime = 31;
-            int result = super.hashCode();
-            result = prime * result + ((lhs == null) ? 0 : lhs.hashCode());
-            result = prime * result + ((rhs == null) ? 0 : rhs.hashCode());
-            return result;
+            return Objects.hash(super.hashCode(), lhs, rhs);
         }
 
         @Override
@@ -290,17 +258,7 @@ public boolean equals(Object obj) {
             if (!super.equals(obj) || getClass() != obj.getClass())
                 return false;
             AndSet other = (AndSet) obj;
-            if (lhs == null) {
-                if (other.lhs != null)
-                    return false;
-            } else if (!lhs.equals(other.lhs))
-                return false;
-            if (rhs == null) {
-                if (other.rhs != null)
-                    return false;
-            } else if (!rhs.equals(other.rhs))
-                return false;
-            return true;
+            return Objects.equals(lhs, other.lhs) && Objects.equals(rhs, other.rhs);
         }
     }
 
@@ -409,11 +367,7 @@ public boolean isValid(TemplateEngineDataProvider dataProvider) {
 
     @Override
     public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((context == null) ? 0 : context.hashCode());
-        result = prime * result + ((template == null) ? 0 : template.hashCode());
-        return result;
+        return Objects.hash(context, template);
     }
 
     @Override
@@ -423,16 +377,6 @@ public boolean equals(Object obj) {
         if (obj == null || getClass() != obj.getClass())
             return false;
         ContextSwitchTemplate other = (ContextSwitchTemplate) obj;
-        if (context == null) {
-            if (other.context != null)
-                return false;
-        } else if (!context.equals(other.context))
-            return false;
-        if (template == null) {
-            if (other.template != null)
-                return false;
-        } else if (!template.equals(other.template))
-            return false;
-        return true;
+        return Objects.equals(context, other.context) && Objects.equals(template, other.template);
     }
 }
