Index: trunk/src/org/openstreetmap/josm/actions/JosmAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/JosmAction.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/actions/JosmAction.java	(revision 18801)
@@ -519,7 +519,5 @@
         }
         if ((checkRes & Command.IS_INCOMPLETE) != 0) {
-            boolean answer = showConfirmOutlyingOperationDialog(operation + "_incomplete", incompleteDialogMessage, dialogTitle);
-            if (!answer)
-                return false;
+            return showConfirmOutlyingOperationDialog(operation + "_incomplete", incompleteDialogMessage, dialogTitle);
         }
         return true;
Index: trunk/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java	(revision 18801)
@@ -157,11 +157,9 @@
         result.removeIf(way -> way.getNodesCount() <= 2);
 
-        if (selectedWays.isEmpty())
-            return result;
-        else {
-            // Return only selected ways
+        // Return only selected ways
+        if (!selectedWays.isEmpty()) {
             result.removeIf(way -> !selectedWays.contains(way));
-            return result;
         }
+        return result;
     }
 
Index: trunk/src/org/openstreetmap/josm/actions/UploadAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 18801)
@@ -62,5 +62,5 @@
      * if they want to be able to veto an upload.
      * <p>
-     * Be default, the standard upload dialog is the only element in the list.
+     * By default, the standard upload dialog is the only element in the list.
      * Plugins should normally insert their code before that, so that the upload
      * dialog is the last thing shown before upload really starts; on occasion
Index: trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java	(revision 18801)
@@ -136,5 +136,5 @@
      *
      * @param layer the data layer from which we upload a subset of primitives
-     * @param toUpload the primitives to upload. If null or empty returns immediatelly
+     * @param toUpload the primitives to upload. If null or empty returns immediately
      */
     public void uploadPrimitives(OsmDataLayer layer, Collection<OsmPrimitive> toUpload) {
Index: trunk/src/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrector.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrector.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrector.java	(revision 18801)
@@ -99,5 +99,5 @@
 
                 StringBuilder result = new StringBuilder();
-                result.append(text.substring(0, m.start(2)))
+                result.append(text, 0, m.start(2))
                       .append(leftRight.equals(a) ? b : a)
                       .append(text.substring(m.end(2)));
Index: trunk/src/org/openstreetmap/josm/actions/downloadtasks/AbstractChangesetDownloadTask.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/downloadtasks/AbstractChangesetDownloadTask.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/actions/downloadtasks/AbstractChangesetDownloadTask.java	(revision 18801)
@@ -104,5 +104,5 @@
      *    Future&lt;?&gt; future = task.download();
      *    // DON'T run this on the Swing EDT or JOSM will freeze
-     *    future.get(); // waits for the dowload task to complete
+     *    future.get(); // waits for the download task to complete
      * </pre>
      *
Index: trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java	(revision 18801)
@@ -106,5 +106,5 @@
      *    Future&lt;?&gt; future = task.download(...);
      *    // DON'T run this on the Swing EDT or JOSM will freeze
-     *    future.get(); // waits for the dowload task to complete
+     *    future.get(); // waits for the download task to complete
      * </pre>
      *
Index: trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java	(revision 18801)
@@ -208,5 +208,5 @@
      * segments for the given pointer position (via MouseEvent) and modifiers.
      * @param e current mouse event
-     * @param modifiers extended mouse modifiers, not necessarly taken from the given mouse event
+     * @param modifiers extended mouse modifiers, not necessarily taken from the given mouse event
      */
     private void addHighlighting(MouseEvent e, int modifiers) {
@@ -256,5 +256,5 @@
      *
      * @param e current mouse event
-     * @param modifiers extended mouse modifiers, not necessarly taken from the given mouse event
+     * @param modifiers extended mouse modifiers, not necessarily taken from the given mouse event
      */
     private void updateCursor(MouseEvent e, int modifiers) {
Index: trunk/src/org/openstreetmap/josm/actions/mapmode/DrawSnapHelper.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/DrawSnapHelper.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/DrawSnapHelper.java	(revision 18801)
@@ -465,5 +465,5 @@
                 EastNorth enOpt = null;
                 double dOpt = 1e5;
-                for (EastNorth en: pointsToProject) { // searching for besht projection
+                for (EastNorth en: pointsToProject) { // searching for best projection
                     double l1 = (en.east()-e0)*pe+(en.north()-n0)*pn;
                     double d1 = Math.abs(l1-l);
Index: trunk/src/org/openstreetmap/josm/actions/upload/UploadHook.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/upload/UploadHook.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/actions/upload/UploadHook.java	(revision 18801)
@@ -7,5 +7,5 @@
 
 /**
- * Change, or block, the upload.
+ * Change or block the upload.
  *
  * The UploadHook may modify the uploaded data silently, it may display a
@@ -17,5 +17,5 @@
 
     /**
-     * Check, and/or change, the data to be uploaded.
+     * Check and/or change the data to be uploaded.
      * Default implementation is to approve the upload.
      * @param apiDataSet the data to upload, modify this to change the data.
Index: trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java	(revision 18801)
@@ -104,7 +104,5 @@
                     Optional<PrimitiveData> o = data.stream()
                             .filter(pd -> pd.getPrimitiveId().equals(osm.getPrimitiveId())).findAny();
-                    if (o.isPresent()) {
-                        osm.load(o.get());
-                    }
+                    o.ifPresent(osm::load);
                 } else {
                     ds.addPrimitive(osm);
Index: trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/DeleteCommand.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/command/DeleteCommand.java	(revision 18801)
@@ -510,5 +510,5 @@
 
         if (ws.getWay().isClosed()) {
-            // If the way is circular (first and last nodes are the same), the way shouldn't be splitted
+            // If the way is circular (first and last nodes are the same), the way shouldn't be split
 
             List<Node> n = new ArrayList<>();
Index: trunk/src/org/openstreetmap/josm/data/Bounds.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/Bounds.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/Bounds.java	(revision 18801)
@@ -502,5 +502,5 @@
     /**
      * Determines if this Bounds object crosses the 180th Meridian.
-     * See http://wiki.openstreetmap.org/wiki/180th_meridian
+     * See <a href="http://wiki.openstreetmap.org/wiki/180th_meridian">180th Meridian</a>.
      * @return true if this Bounds object crosses the 180th Meridian.
      */
Index: trunk/src/org/openstreetmap/josm/data/Version.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/Version.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/Version.java	(revision 18801)
@@ -46,5 +46,5 @@
 
     /**
-     * Initializes the version infos from the revision resource file
+     * Initializes the version info from the revision resource file
      *
      * @param revisionInfo the revision info from a revision resource file as InputStream
Index: trunk/src/org/openstreetmap/josm/data/gpx/GpxTrackSegment.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/gpx/GpxTrackSegment.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/gpx/GpxTrackSegment.java	(revision 18801)
@@ -47,6 +47,6 @@
         for (WayPoint tpt : wayPoints) {
             if (last != null) {
-                Double d = last.greatCircleDistance(tpt);
-                if (!d.isNaN() && !d.isInfinite()) {
+                double d = last.greatCircleDistance(tpt);
+                if (!Double.isNaN(d) && !Double.isInfinite(d)) {
                     result += d;
                 }
Index: trunk/src/org/openstreetmap/josm/data/imagery/DefaultLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/DefaultLayer.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/imagery/DefaultLayer.java	(revision 18801)
@@ -9,4 +9,5 @@
 
 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
+import org.openstreetmap.josm.tools.Utils;
 
 /**
@@ -34,5 +35,5 @@
         this.layerName = layerName == null ? "" : layerName;
         this.style = style == null ? "" : style;
-        if (imageryType != ImageryType.WMTS && !(tileMatrixSet == null || "".equals(tileMatrixSet))) {
+        if (imageryType != ImageryType.WMTS && !Utils.isEmpty(tileMatrixSet)) {
             throw new IllegalArgumentException(tr("{0} imagery has tileMatrixSet defined to: {1}", imageryType, tileMatrixSet));
         }
Index: trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java	(revision 18801)
@@ -285,5 +285,5 @@
 
     /**
-     * Stores the bookmakrs in the settings.
+     * Stores the bookmarks in the settings.
      */
     public static void saveBookmarks() {
Index: trunk/src/org/openstreetmap/josm/data/oauth/IOAuthToken.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/oauth/IOAuthToken.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/oauth/IOAuthToken.java	(revision 18801)
@@ -13,5 +13,5 @@
      * Sign a client
      * @param client The client to sign
-     * @throws OAuthException if the OAuth token type is unknown (AKA we do't know how to handle it)
+     * @throws OAuthException if the OAuth token type is unknown (AKA we don't know how to handle it)
      */
     void sign(HttpClient client) throws OAuthException;
Index: trunk/src/org/openstreetmap/josm/data/osm/ChangesetCache.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/ChangesetCache.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/osm/ChangesetCache.java	(revision 18801)
@@ -155,6 +155,6 @@
 
     /**
-     * Returns the list of changesets contained in the cache.
-     * @return the list of changesets contained in the cache
+     * Returns the set of changesets contained in the cache.
+     * @return the set of changesets contained in the cache
      */
     public Set<Changeset> getChangesets() {
Index: trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 18801)
@@ -374,6 +374,6 @@
 
     /**
-     * Replies the set of changeset tags to be applied when or if this is ever uploaded.
-     * @return the set of changeset tags
+     * Replies the map of changeset tags to be applied when or if this is ever uploaded.
+     * @return the map of changeset tags
      * @see #addChangeSetTag
      */
Index: trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java	(revision 18801)
@@ -150,6 +150,5 @@
 
     /**
-     * Postprocess the dataset and fix all merged references to point to the actual
-     * data.
+     * Postprocess the dataset and fix all merged references to point to the actual data.
      */
     public void fixReferences() {
Index: trunk/src/org/openstreetmap/josm/data/osm/FilterMatcher.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/FilterMatcher.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/osm/FilterMatcher.java	(revision 18801)
@@ -78,9 +78,5 @@
 
         FilterInfo(Filter filter) throws SearchParseError {
-            if (filter.mode == SearchMode.remove || filter.mode == SearchMode.in_selection) {
-                isDelete = true;
-            } else {
-                isDelete = false;
-            }
+            isDelete = filter.mode == SearchMode.remove || filter.mode == SearchMode.in_selection;
 
             Match compiled = SearchCompiler.compile(filter);
Index: trunk/src/org/openstreetmap/josm/data/osm/IPrimitive.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/IPrimitive.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/osm/IPrimitive.java	(revision 18801)
@@ -288,5 +288,5 @@
      *
      * @return date of last modification
-     * @see #getInstant
+     * @see #setInstant
      */
     Instant getInstant();
@@ -394,5 +394,5 @@
     /**
      * Get an object to synchronize the style cache on. This <i>should</i> be a field that does not change during paint.
-     * By default, it returns the current object, but should be overriden to avoid some performance issues.
+     * By default, it returns the current object, but should be overridden to avoid some performance issues.
      * @return A non-{@code null} object to synchronize on when painting
      */
Index: trunk/src/org/openstreetmap/josm/data/osm/Node.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Node.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/osm/Node.java	(revision 18801)
@@ -359,6 +359,6 @@
 
     /**
-     * Replies the set of referring ways.
-     * @return the set of referring ways
+     * Replies the list of referring ways.
+     * @return the list of referring ways
      * @since 12031
      */
Index: trunk/src/org/openstreetmap/josm/data/osm/OsmDataManager.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmDataManager.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/osm/OsmDataManager.java	(revision 18801)
@@ -71,7 +71,5 @@
         Optional<OsmDataLayer> layer = MainApplication.getLayerManager().getLayersOfType(OsmDataLayer.class).stream()
                 .filter(l -> l.data.equals(ds)).findFirst();
-        if (layer.isPresent()) {
-            MainApplication.getLayerManager().setActiveLayer(layer.get());
-        }
+        layer.ifPresent(osmDataLayer -> MainApplication.getLayerManager().setActiveLayer(osmDataLayer));
     }
 
Index: trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 18801)
@@ -992,7 +992,7 @@
 
     /**
-     * Equal, if the id (and class) is equal.
-     *
-     * An primitive is equal to its incomplete counter part.
+     * Equal if the id (and class) are equal.
+     * <p>
+     * A primitive is equal to its incomplete counterpart.
      */
     @Override
@@ -1010,6 +1010,6 @@
     /**
      * Return the id plus the class type encoded as hashcode or super's hashcode if id is 0.
-     *
-     * An primitive has the same hashcode as its incomplete counterpart.
+     * <p>
+     * A primitive has the same hashcode as its incomplete counterpart.
      */
     @Override
Index: trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java	(revision 18801)
@@ -36,13 +36,19 @@
     /**
      * Discouraged synonym for {@link #TRUE_VALUE}
-     */
+     * @deprecated since xxx, use {@link #TRUE_VALUE} instead.
+     */
+    @Deprecated
     public static final String trueval = TRUE_VALUE;
     /**
      * Discouraged synonym for {@link #FALSE_VALUE}
-     */
+     * @deprecated since xxx, use {@link #FALSE_VALUE} instead.
+     */
+    @Deprecated
     public static final String falseval = FALSE_VALUE;
     /**
      * Discouraged synonym for {@link #REVERSE_VALUE}
-     */
+     * @deprecated since xxx, use {@link #REVERSE_VALUE} instead.
+     */
+    @Deprecated
     public static final String reverseval = REVERSE_VALUE;
 
@@ -54,7 +60,7 @@
      * Converts a string to a boolean value
      * @param value The string to convert
-     * @return {@link Boolean#TRUE} if that string represents a true value,
-     *         {@link Boolean#FALSE} if it represents a false value,
-     *         <code>null</code> otherwise.
+     * @return {@link Boolean#TRUE} if that string represents a true value,<br>
+     *         {@link Boolean#FALSE} if it represents a false value,<br>
+     *         {@code null} otherwise.
      */
     public static Boolean getOsmBoolean(String value) {
@@ -75,5 +81,5 @@
     public static String getNamedOsmBoolean(String value) {
         Boolean res = getOsmBoolean(value);
-        return res == null ? value : (res ? trueval : falseval);
+        return res == null ? value : (res ? TRUE_VALUE : FALSE_VALUE);
     }
 
@@ -119,5 +125,5 @@
      * Check if a tag value represents a boolean false value
      * @param value The value to check
-     * @return true if it is a true value.
+     * @return true if it is a false value.
      */
     public static boolean isFalse(String value) {
@@ -138,5 +144,5 @@
     /**
      * Creates a new OSM primitive around (0,0) according to the given assertion. Originally written for unit tests,
-     * this can also be used in another places like validation of local MapCSS validator rules.
+     * this can also be used in other places like validation of local MapCSS validator rules.
      * Ways and relations created using this method are empty.
      * @param assertion The assertion describing OSM primitive (ex: "way name=Foo railway=rail")
@@ -151,5 +157,5 @@
     /**
      * Creates a new OSM primitive according to the given assertion. Originally written for unit tests,
-     * this can also be used in another places like validation of local MapCSS validator rules.
+     * this can also be used in other places like validation of local MapCSS validator rules.
      * @param assertion The assertion describing OSM primitive (ex: "way name=Foo railway=rail")
      * @param around the coordinate at which the primitive will be located
Index: trunk/src/org/openstreetmap/josm/data/osm/Relation.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Relation.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/osm/Relation.java	(revision 18801)
@@ -525,6 +525,6 @@
     public Collection<OsmPrimitive> getIncompleteMembers() {
         return Arrays.stream(members)
-                .filter(rm -> rm.getMember().isIncomplete())
                 .map(RelationMember::getMember)
+                .filter(OsmPrimitive::isIncomplete)
                 .collect(Collectors.toSet());
     }
Index: trunk/src/org/openstreetmap/josm/data/osm/Storage.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Storage.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/osm/Storage.java	(revision 18801)
@@ -15,5 +15,5 @@
 
 /**
- * A Set-like class that allows looking up equivalent preexising instance.
+ * A Set-like class that allows looking up equivalent preexisting instance.
  * It is useful wherever one would use self-mapping construct like
  * <code>Map&lt;T,T&gt;.put(t,t)</code>, that is, for caches, uniqueness filters or similar.
Index: trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java	(revision 18801)
@@ -919,7 +919,7 @@
             this.key = key;
             this.value = value == null ? "" : value;
-            if ("".equals(this.value) && "*".equals(key)) {
+            if (this.value.isEmpty() && "*".equals(key)) {
                 mode = Mode.NONE;
-            } else if ("".equals(this.value)) {
+            } else if (this.value.isEmpty()) {
                 if (regexp) {
                     mode = Mode.MISSING_KEY_REGEXP;
Index: trunk/src/org/openstreetmap/josm/data/projection/Ellipsoid.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/projection/Ellipsoid.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/projection/Ellipsoid.java	(revision 18801)
@@ -357,5 +357,5 @@
         double lat0 = 2*Math.atan(Math.exp(latIso))-Math.PI/2;
         double lati = lat0;
-        double lati1 = 1.0; // random value to start the iterative processus
+        double lati1 = 1.0; // random value to start the iterative processes
         while (Math.abs(lati1-lati) >= epsilon) {
             lati = lati1;
Index: trunk/src/org/openstreetmap/josm/data/tagging/ac/AutoCompletionPriority.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/tagging/ac/AutoCompletionPriority.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/tagging/ac/AutoCompletionPriority.java	(revision 18801)
@@ -127,9 +127,5 @@
             return ds;
 
-        int std = Boolean.compare(inStandard, other.inStandard);
-        if (std != 0)
-            return std;
-
-        return 0;
+        return Boolean.compare(inStandard, other.inStandard);
     }
 
Index: trunk/src/org/openstreetmap/josm/data/validation/ValidationTask.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/ValidationTask.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/validation/ValidationTask.java	(revision 18801)
@@ -43,5 +43,5 @@
      * @param tests                     the tests to run
      * @param validatedPrimitives       the collection of primitives to validate.
-     * @param formerValidatedPrimitives the last collection of primitives being validates. May be null.
+     * @param formerValidatedPrimitives the last collection of primitives being validated. May be null.
      */
     public ValidationTask(Collection<Test> tests,
@@ -58,5 +58,5 @@
      * @param tests                     the tests to run
      * @param validatedPrimitives       the collection of primitives to validate.
-     * @param formerValidatedPrimitives the last collection of primitives being validates. May be null.
+     * @param formerValidatedPrimitives the last collection of primitives being validated. May be null.
      * @param beforeUpload              {@code true} if this is being run prior to upload
      * @since 18752
Index: trunk/src/org/openstreetmap/josm/data/validation/routines/EmailValidator.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/routines/EmailValidator.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/validation/routines/EmailValidator.java	(revision 18801)
@@ -126,7 +126,7 @@
 
     /**
-     * <p>Checks if a field has a valid e-mail address.</p>
-     *
-     * @param email The value validation is being performed on.  A <code>null</code>
+     * Checks if a field has a valid e-mail address.
+     *
+     * @param email The value validation is being performed on. A <code>null</code>
      *              value is considered invalid.
      * @return true if the email address is valid.
Index: trunk/src/org/openstreetmap/josm/data/validation/routines/InetAddressValidator.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/routines/InetAddressValidator.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/validation/routines/InetAddressValidator.java	(revision 18801)
@@ -157,5 +157,5 @@
         for (int index = 0; index < octets.length; index++) {
             String octet = octets[index];
-            if (octet.length() == 0) {
+            if (octet.isEmpty()) {
                 emptyOctets++;
                 if (emptyOctets > 1) {
Index: trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java	(revision 18801)
@@ -258,5 +258,5 @@
 
     /**
-     * Customizable constructor. Validation behavior is modifed by passing in options.
+     * Customizable constructor. Validation behavior is modified by passing in options.
      * @param schemes the set of valid schemes. Ignored if the ALLOW_ALL_SCHEMES option is set.
      * @param authorityValidator Regular expression validator used to validate the authority part
Index: trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java	(revision 18801)
@@ -99,5 +99,5 @@
             if (w.isClosed() && w.hasTag(HIGHWAY, CLASSIFIED_HIGHWAYS) && w.hasTag("junction", "circular", "roundabout")
                     && IN_DOWNLOADED_AREA_STRICT.test(w)) {
-                // TODO: find out how to handle splitted roundabouts (see #12841)
+                // TODO: find out how to handle split roundabouts (see #12841)
                 testWrongRoundabout(w);
             }
Index: trunk/src/org/openstreetmap/josm/data/validation/tests/Lanes.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/Lanes.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/Lanes.java	(revision 18801)
@@ -64,6 +64,6 @@
                             .build());
                 }
-            } catch (NumberFormatException ignore) {
-                Logging.debug(ignore.getMessage());
+            } catch (NumberFormatException e) {
+                Logging.debug(e.getMessage());
             }
         }
@@ -76,12 +76,12 @@
         final String backward = Utils.firstNonNull(p.get("lanes:backward"), "0");
         try {
-        if (Integer.parseInt(lanes) < Integer.parseInt(forward) + Integer.parseInt(backward)) {
-            errors.add(TestError.builder(this, Severity.WARNING, 3101)
-                    .message(tr("Number of {0} greater than {1}", tr("{0}+{1}", "lanes:forward", "lanes:backward"), "lanes"))
-                    .primitives(p)
-                    .build());
-        }
-        } catch (NumberFormatException ignore) {
-            Logging.debug(ignore.getMessage());
+            if (Integer.parseInt(lanes) < Integer.parseInt(forward) + Integer.parseInt(backward)) {
+                errors.add(TestError.builder(this, Severity.WARNING, 3101)
+                        .message(tr("Number of {0} greater than {1}", tr("{0}+{1}", "lanes:forward", "lanes:backward"), "lanes"))
+                        .primitives(p)
+                        .build());
+            }
+        } catch (NumberFormatException e) {
+            Logging.debug(e.getMessage());
         }
     }
Index: trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 18801)
@@ -446,5 +446,5 @@
                 // add frequently changing info to progress monitor so that it
                 // doesn't seem to hang when test takes longer than 0.5 seconds
-                if (cnt % 10000 == 0 && stopwatch.elapsed() >= 500) {
+                if (cnt % 10_000 == 0 && stopwatch.elapsed() >= 500) {
                     progressMonitor.setExtraText(tr(" {0}: {1} of {2} elements done", title, cnt, selection.size()));
                 }
Index: trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java	(revision 18801)
@@ -10,4 +10,5 @@
 import java.util.EnumSet;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -16,4 +17,5 @@
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.stream.Collectors;
 
@@ -430,15 +432,18 @@
 
     private void checkLoop(Relation parent, List<Relation> path) {
-        if (path.contains(parent)) {
+        Set<Relation> pathSet = new HashSet<>(path);
+        if (pathSet.contains(parent)) {
             Iterator<List<Relation>> iter = loops.iterator();
+            Set<Relation> loop = new HashSet<>();
             while (iter.hasNext()) {
-                List<Relation> loop = iter.next();
+                loop.addAll(iter.next());
                 if (loop.size() > path.size() && loop.containsAll(path)) {
                     // remove same loop with irrelevant parent
                     iter.remove();
-                } else if (path.size() >= loop.size() && path.containsAll(loop)) {
+                } else if (path.size() >= loop.size() && pathSet.containsAll(loop)) {
                     // same or smaller loop is already known
                     return;
                 }
+                loop.clear();
             }
             if (path.get(0).equals(parent)) {
Index: trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java	(revision 18801)
@@ -915,5 +915,5 @@
         }
 
-        if (fixedKey != null && !"".equals(fixedKey) && !fixedKey.equals(key)) {
+        if (!Utils.isEmpty(fixedKey) && !fixedKey.equals(key)) {
             final String proposedKey = fixedKey;
             // misspelled preset key
Index: trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java	(revision 18801)
@@ -113,5 +113,5 @@
         }
 
-        // #20393 - ways tagged with just area=yes are catched by MapCSS tests
+        // #20393 - ways tagged with just area=yes are caught by MapCSS tests
         if (!w.isTagged() && !w.hasTag("area", OsmUtils.TRUE_VALUE) && !waysUsedInRelations.contains(w)) {
             if (w.hasKeys()) {
Index: trunk/src/org/openstreetmap/josm/data/vector/DataStore.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/vector/DataStore.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/vector/DataStore.java	(revision 18801)
@@ -80,5 +80,5 @@
     /**
      * Add a datasource to this data set
-     * @param dataSource The data soure to add
+     * @param dataSource The datasource to add
      */
     public void addDataSource(DataSource dataSource) {
Index: trunk/src/org/openstreetmap/josm/data/vector/VectorDataStore.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/vector/VectorDataStore.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/data/vector/VectorDataStore.java	(revision 18801)
@@ -80,5 +80,5 @@
                 mergeWays(mergedRelation);
             } else if (!(primitive instanceof IWay)) {
-                // Can't merge, ever (one of the childs is a node/relation)
+                // Can't merge, ever (one of the children is a node/relation)
                 mergedRelation.remove(JOSM_MERGE_TYPE_KEY);
             }
Index: trunk/src/org/openstreetmap/josm/gui/MainApplication.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 18801)
@@ -993,5 +993,5 @@
 
         if (Config.getPref().getBoolean("debug.edt-checker.enable", Version.getInstance().isLocalBuild())) {
-            // Repaint manager is registered so late for a reason - there is lots of violation during startup process
+            // Repaint manager is registered so late for a reason - there are lots of violations during startup process
             // but they don't seem to break anything and are difficult to fix
             Logging.info("Enabled EDT checker, wrongful access to gui from non EDT thread will be printed to console");
@@ -1191,5 +1191,5 @@
         UIManager.put("OptionPane.cancelIcon", ImageProvider.getIfAvailable("cancel"));
         UIManager.put("OptionPane.noIcon", UIManager.get("OptionPane.cancelIcon"));
-        // Ensures caret color is the same than text foreground color, see #12257
+        // Ensures caret color is the same as text foreground color, see #12257
         // See https://docs.oracle.com/javase/8/docs/api/javax/swing/plaf/synth/doc-files/componentProperties.html
         for (String p : Arrays.asList(
Index: trunk/src/org/openstreetmap/josm/gui/conflict/pair/AbstractListMergeModel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/conflict/pair/AbstractListMergeModel.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/conflict/pair/AbstractListMergeModel.java	(revision 18801)
@@ -635,5 +635,5 @@
          * participates in the current {@link ComparePairType}
          *
-         * @return true, if the if the {@link ListRole} of this {@link EntriesTableModel}
+         * @return true, if the {@link ListRole} of this {@link EntriesTableModel}
          * participates in the current {@link ComparePairType}
          *
Index: trunk/src/org/openstreetmap/josm/gui/conflict/pair/AbstractListMerger.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/conflict/pair/AbstractListMerger.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/conflict/pair/AbstractListMerger.java	(revision 18801)
@@ -775,5 +775,5 @@
 
         /**
-         * Java 1.5 doesn't known Action.SELECT_KEY. Wires a toggle button to this action
+         * Java 1.5 doesn't know Action.SELECT_KEY. Wires a toggle button to this action
          * such that the action gets notified about item state changes and the button gets
          * notified about selection state changes of the action.
Index: trunk/src/org/openstreetmap/josm/gui/conflict/pair/ComparePairType.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/conflict/pair/ComparePairType.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/conflict/pair/ComparePairType.java	(revision 18801)
@@ -23,5 +23,5 @@
 
     /**
-     * compare their version of an {@link org.openstreetmap.josm.data.osm.OsmPrimitive} with the merged veresion
+     * compare their version of an {@link org.openstreetmap.josm.data.osm.OsmPrimitive} with the merged version
      */
     THEIR_WITH_MERGED(tr("Their with Merged"), THEIR_ENTRIES, MERGED_ENTRIES);
Index: trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditor.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditor.java	(revision 18801)
@@ -217,8 +217,8 @@
         protected void renderValue(Object value) {
             setFont(UIManager.getFont("ComboBox.font"));
-            if (String.class.isInstance(value)) {
-                setText(String.class.cast(value));
-            } else if (MultiValueDecisionType.class.isInstance(value)) {
-                switch(MultiValueDecisionType.class.cast(value)) {
+            if (value instanceof String) {
+                setText((String) value);
+            } else if (value instanceof MultiValueDecisionType) {
+                switch((MultiValueDecisionType) value) {
                 case UNDECIDED:
                     setText(tr("Choose a value"));
Index: trunk/src/org/openstreetmap/josm/gui/correction/CorrectionTable.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/correction/CorrectionTable.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/correction/CorrectionTable.java	(revision 18801)
@@ -39,5 +39,5 @@
 
         final int correctionsSize = correctionTableModel.getCorrections().size();
-        final int lines = correctionsSize > MAX_VISIBLE_LINES ? MAX_VISIBLE_LINES : correctionsSize;
+        final int lines = Math.min(correctionsSize, MAX_VISIBLE_LINES);
         setPreferredScrollableViewportSize(new Dimension(400, lines * getRowHeight()));
         getColumnModel().getColumn(correctionTableModel.getApplyColumn()).setPreferredWidth(40);
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java	(revision 18801)
@@ -511,5 +511,5 @@
 
     /**
-     * Action to undo or redo all commands up to (and including) the seleced item.
+     * Action to undo or redo all commands up to (and including) the selected item.
      */
     protected class UndoRedoAction extends JosmAction implements IEnabledStateUpdating {
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java	(revision 18801)
@@ -14,4 +14,5 @@
 import java.util.Collections;
 import java.util.EnumSet;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -592,5 +593,5 @@
         public void setSelectedRelations(Collection<? extends IRelation<?>> sel) {
             if (!Utils.isEmpty(sel)) {
-                if (!getVisibleRelations().containsAll(sel)) {
+                if (!new HashSet<>(getVisibleRelations()).containsAll(sel)) {
                     resetFilter();
                 }
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetsInActiveDataLayerListModel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetsInActiveDataLayerListModel.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetsInActiveDataLayerListModel.java	(revision 18801)
@@ -82,9 +82,5 @@
         // is already registered to receive DataChangedEvents from the current edit layer
         DataSet ds = e.getSource().getActiveDataSet();
-        if (ds != null) {
-            initFromDataSet(ds);
-        } else {
-            initFromDataSet(null);
-        }
+        initFromDataSet(ds);
     }
 }
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UidInputFieldValidator.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UidInputFieldValidator.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UidInputFieldValidator.java	(revision 18801)
@@ -66,7 +66,5 @@
         try {
             int uid = Integer.parseInt(value.trim());
-            if (uid > 0)
-                return uid;
-            return 0;
+            return Math.max(uid, 0);
         } catch (NumberFormatException e) {
             return 0;
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java	(revision 18801)
@@ -136,5 +136,5 @@
  * If no object is selected, the dialog list is empty.
  * If only one is selected, all tags of this object are selected.
- * If more than one object are selected, the sum of all tags are displayed. If the
+ * If more than one object is selected, the sum of all tags is displayed. If the
  * different objects share the same tag, the shared value is displayed. If they have
  * different values, all of them are put in a combo box and the string "&lt;different&gt;"
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java	(revision 18801)
@@ -899,5 +899,5 @@
 
     /**
-     * Asks confirmationbefore adding a primitive.
+     * Asks confirmation before adding a primitive.
      * @param primitive primitive to add
      * @return {@code true} is user confirms the operation, {@code false} otherwise
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java	(revision 18801)
@@ -27,4 +27,5 @@
 import org.openstreetmap.josm.actions.HistoryInfoAction;
 import org.openstreetmap.josm.actions.ZoomToAction;
+import org.openstreetmap.josm.data.osm.IPrimitive;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Relation;
@@ -131,6 +132,6 @@
             Collection<RelationMember> sel = getMemberTableModel().getSelectedMembers();
             final Set<OsmPrimitive> toHighlight = sel.stream()
-                    .filter(r -> r.getMember().isUsable())
                     .map(RelationMember::getMember)
+                    .filter(IPrimitive::isUsable)
                     .collect(Collectors.toSet());
             SwingUtilities.invokeLater(() -> {
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java	(revision 18801)
@@ -551,7 +551,9 @@
     public Set<OsmPrimitive> getChildPrimitives(Collection<? extends OsmPrimitive> referenceSet) {
         if (referenceSet == null) return null;
+        Collection<? extends OsmPrimitive> referenceActualSet = referenceSet instanceof Set ?
+                (Set<? extends OsmPrimitive>) referenceSet : new HashSet<>(referenceSet);
         return members.stream()
-                .filter(m -> referenceSet.contains(m.getMember()))
                 .map(RelationMember::getMember)
+                .filter(referenceActualSet::contains)
                 .collect(Collectors.toSet());
     }
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java	(revision 18801)
@@ -432,5 +432,5 @@
     /**
      * Returns the filter list
-     * @return the list of primitives used for filtering
+     * @return the set of primitives used for filtering
      */
     public Set<? extends OsmPrimitive> getFilter() {
Index: trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java	(revision 18801)
@@ -144,5 +144,4 @@
         gc.weightx = 1.0;
         gc.weighty = 1.0;
-        gc.gridx = 1;
         dlg.add(new JScrollPane(bookmarks), gc);
 
Index: trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowser.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowser.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowser.java	(revision 18801)
@@ -6,5 +6,5 @@
 import java.awt.BorderLayout;
 import java.awt.Dimension;
-import java.util.Arrays;
+import java.util.stream.Stream;
 
 import javax.swing.JPanel;
@@ -19,5 +19,5 @@
 
 /**
- * HistoryBrowser is an UI component which displays history information about an {@link OsmPrimitive}.
+ * HistoryBrowser is a UI component which displays history information about an {@link OsmPrimitive}.
  *
  * @since 1709
@@ -162,5 +162,5 @@
             model = null;
         }
-        Arrays.asList(tagInfoViewer, nodeListViewer, relationMemberListViewer, coordinateInfoViewer).stream()
+        Stream.of(tagInfoViewer, nodeListViewer, relationMemberListViewer, coordinateInfoViewer)
                 .filter(Destroyable.class::isInstance).forEach(Destroyable::destroy);
         tagInfoViewer = null;
Index: trunk/src/org/openstreetmap/josm/gui/io/ActionFlagsTableCell.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/io/ActionFlagsTableCell.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/io/ActionFlagsTableCell.java	(revision 18801)
@@ -27,5 +27,5 @@
  * handles everything on its own, in other words it renders itself and also functions
  * as editor so the checkboxes may be set by the user.
- *
+ * <p>
  * Intended usage is like this:
  * <code>
@@ -35,5 +35,5 @@
  * <br>col.setCellEditor(aftc);
  * </code>
- *
+ * <p>
  * Note: Do not use the same object both as <code>TableCellRenderer</code> and
  * <code>TableCellEditor</code> - this can mess up the current editor component
Index: trunk/src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java	(revision 18801)
@@ -54,5 +54,4 @@
     private JosmComboBoxModel<Changeset> model;
     private JCheckBox cbCloseAfterUpload;
-    private JButton btnClose;
 
     /**
@@ -127,5 +126,5 @@
         gc.gridx++;
         CloseChangesetAction closeChangesetAction = new CloseChangesetAction();
-        btnClose = new JButton(closeChangesetAction);
+        JButton btnClose = new JButton(closeChangesetAction);
         btnClose.setPreferredSize(prefSize);
         btnClose.setMinimumSize(prefSize);
@@ -278,5 +277,5 @@
     public void changesetCacheUpdated(ChangesetCacheEvent event) {
         // This listener might have been called by a background task.
-        SwingUtilities.invokeLater(() -> refreshCombo());
+        SwingUtilities.invokeLater(this::refreshCombo);
     }
 }
Index: trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetDialog.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetDialog.java	(revision 18801)
@@ -181,5 +181,5 @@
      * Sets whether this dialog is canceled
      *
-     * @param canceled true, if this dialog is canceld
+     * @param canceled true, if this dialog is canceled
      */
     protected void setCanceled(boolean canceled) {
Index: trunk/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java	(revision 18801)
@@ -131,9 +131,8 @@
      */
     public static void processDownloadOperation(String address, String path, String parentDir, boolean mkdir, boolean unzip) {
-        String dir = parentDir;
         if (path.contains("..") || path.startsWith("/") || path.contains(":")) {
             return; // some basic protection
         }
-        File fOut = new File(dir, path);
+        File fOut = new File(parentDir, path);
         DownloadFileTask downloadFileTask = new DownloadFileTask(MainApplication.getMainFrame(), address, fOut, mkdir, unzip);
 
Index: trunk/src/org/openstreetmap/josm/gui/io/UploadDialogModel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/io/UploadDialogModel.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/io/UploadDialogModel.java	(revision 18801)
@@ -76,9 +76,8 @@
      */
     String findHashTags(String comment) {
-        String hashtags = String.join(";",
-            Arrays.stream(comment.split("\\s", -1))
-                .map(s -> Utils.strip(s, ",;"))
-                .filter(s -> s.matches("#[a-zA-Z0-9][-_a-zA-Z0-9]+"))
-                .collect(Collectors.toList()));
+        String hashtags = Arrays.stream(comment.split("\\s", -1))
+            .map(s -> Utils.strip(s, ",;"))
+            .filter(s -> s.matches("#[a-zA-Z0-9][-_a-zA-Z0-9]+"))
+            .collect(Collectors.joining(";"));
         return hashtags.isEmpty() ? null : hashtags;
     }
@@ -156,5 +155,5 @@
     public void putAll(Map<String, String> map) {
         commitPendingEdit();
-        map.forEach((key, value) -> doPut(key, value));
+        map.forEach(this::doPut);
         setDirty(true);
         fireTableDataChanged();
Index: trunk/src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java	(revision 18801)
@@ -79,5 +79,5 @@
     @Override
     public boolean acceptFile(File pathname, Layer layer) {
-        return isSupportedLayer(layer) ? super.acceptFile(pathname, layer) : false;
+        return isSupportedLayer(layer) && super.acceptFile(pathname, layer);
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(revision 18801)
@@ -779,5 +779,5 @@
         Logging.debug("zoomChanged(): {0}", currentZoomLevel);
         if (tileLoader instanceof TMSCachedTileLoader) {
-            ((TMSCachedTileLoader) tileLoader).cancelOutstandingTasks();
+            tileLoader.cancelOutstandingTasks();
         }
         if (invalidate) {
@@ -1149,5 +1149,5 @@
             StringBuilder ret = new StringBuilder();
             for (String s: text.split(" ", -1)) {
-                if (g.getFontMetrics().stringWidth(line.toString() + s) > tileSource.getTileSize()) {
+                if (g.getFontMetrics().stringWidth(line + s) > tileSource.getTileSize()) {
                     ret.append(line).append('\n');
                     line.setLength(0);
Index: trunk/src/org/openstreetmap/josm/gui/layer/AutosaveTask.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/AutosaveTask.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/layer/AutosaveTask.java	(revision 18801)
@@ -395,5 +395,5 @@
         List<File> result = new ArrayList<>();
         try {
-            File[] files = autosaveDir.listFiles((FileFilter)
+            File[] files = autosaveDir.listFiles(
                     pathname -> OsmImporter.FILE_FILTER.accept(pathname) || NoteImporter.FILE_FILTER.accept(pathname));
             if (files == null)
Index: trunk/src/org/openstreetmap/josm/gui/layer/MainLayerManager.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/MainLayerManager.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/layer/MainLayerManager.java	(revision 18801)
@@ -27,5 +27,5 @@
  * The active layer is the layer the user is currently working on.
  * <p>
- * The edit layer is an data layer that we currently work with.
+ * The edit layer is a data layer that we currently work with.
  * @author Michael Zangl
  * @since 10279
@@ -211,5 +211,5 @@
 
     /**
-     * Adds a active/edit layer change listener. Fire a fake active-layer-changed-event right after adding
+     * Adds an active/edit layer change listener. Fire a fake active-layer-changed-event right after adding
      * the listener. The previous layers will be null. The listener is notified in the current thread.
      * @param listener the listener.
Index: trunk/src/org/openstreetmap/josm/gui/layer/ValidatorLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/ValidatorLayer.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/layer/ValidatorLayer.java	(revision 18801)
@@ -101,5 +101,5 @@
                 .collect(Collectors.joining());
 
-        if (b.length() == 0)
+        if (b.isEmpty())
             return "<html>" + tr("No validation errors") + "</html>";
         else
Index: trunk/src/org/openstreetmap/josm/gui/layer/gpx/DateFilterPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/gpx/DateFilterPanel.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/layer/gpx/DateFilterPanel.java	(revision 18801)
@@ -107,5 +107,5 @@
 
     /**
-     * If possible, load date ragne and "zero timestamp" option from preferences
+     * If possible, load date range and "zero timestamp" option from preferences
      * Called by other components when it is needed.
      */
Index: trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java	(revision 18801)
@@ -10,6 +10,6 @@
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.Comparator;
+import java.util.List;
 import java.util.stream.Collectors;
 
@@ -126,5 +126,5 @@
         boolean hasTracks = !Utils.isEmpty(layer.data.tracks);
         boolean hasWaypoints = !Utils.isEmpty(layer.data.waypoints);
-        Collection<WayPoint> waypoints = new ArrayList<>();
+        List<WayPoint> waypoints = new ArrayList<>();
         boolean timedMarkersOmitted = false;
         boolean untimedMarkersOmitted = false;
@@ -273,5 +273,5 @@
 
         // we must have got at least one waypoint now
-        ((ArrayList<WayPoint>) waypoints).sort(Comparator.naturalOrder());
+        waypoints.sort(Comparator.naturalOrder());
 
         firstTime = -1.0; // this time of the first waypoint, not first trackpoint
Index: trunk/src/org/openstreetmap/josm/gui/layer/imagery/ColorfulFilter.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/imagery/ColorfulFilter.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/layer/imagery/ColorfulFilter.java	(revision 18801)
@@ -17,4 +17,5 @@
 
 import org.openstreetmap.josm.tools.Logging;
+import org.openstreetmap.josm.tools.Utils;
 
 /**
@@ -211,11 +212,5 @@
     private int mixInt(int color, double luminosity) {
         int val = (int) (colorfulness * color + (1 - colorfulness) * luminosity);
-        if (val < 0) {
-            return 0;
-        } else if (val > 0xff) {
-            return 0xff;
-        } else {
-            return val;
-        }
+        return Utils.clamp(val, 0, 0xff);
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java	(revision 18801)
@@ -212,5 +212,5 @@
         /**
          * Create a new float operation that compares two float values
-         * @param comparatorResult A function to mapt the result of the comparison
+         * @param comparatorResult A function to map the result of the comparison
          */
         Op(IntFunction<Boolean> comparatorResult) {
@@ -830,5 +830,5 @@
          */
         static boolean unclosed_multipolygon(Environment e) {
-            return e.osm instanceof Relation && ((Relation) e.osm).isMultipolygon() &&
+            return e.osm instanceof Relation && e.osm.isMultipolygon() &&
                     !e.osm.isIncomplete() && !((Relation) e.osm).hasIncompleteMembers() &&
                     !MultipolygonCache.getInstance().get((Relation) e.osm).getOpenEnds().isEmpty();
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj	(revision 18801)
@@ -712,5 +712,5 @@
 {
     boolean not = false;
-    KeyMatchType matchType = null;;
+    KeyMatchType matchType = null;
     String key;
 }
@@ -733,5 +733,5 @@
     float f;
     int i;
-    KeyMatchType matchType = null;;
+    KeyMatchType matchType = null;
     Op op;
     boolean considerValAsKey = false;
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleIndex.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleIndex.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleIndex.java	(revision 18801)
@@ -149,5 +149,5 @@
             }
         } else if (p instanceof IRelation) {
-            if (((IRelation<?>) p).isMultipolygon()) {
+            if (p.isMultipolygon()) {
                 return multipolygonRules;
             } else if (p.hasKey("#canvas")) {
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java	(revision 18801)
@@ -380,11 +380,11 @@
         StringBuilder s = new StringBuilder(64).append("NodeElement{").append(super.toString());
         if (mapImage != null) {
-            s.append(" icon=[" + mapImage + ']');
+            s.append(" icon=[").append(mapImage).append(']');
         }
         if (mapImage != null && mapImageAngle != null) {
-            s.append(" mapImageAngle=[" + mapImageAngle + ']');
+            s.append(" mapImageAngle=[").append(mapImageAngle).append(']');
         }
         if (symbol != null) {
-            s.append(" symbol=[" + symbol + ']');
+            s.append(" symbol=[").append(symbol).append(']');
         }
         s.append('}');
Index: trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java	(revision 18801)
@@ -199,7 +199,4 @@
         for (String setCookie: setCookies) {
             String[] kvPairs = setCookie.split(";", -1);
-            if (kvPairs.length == 0) {
-                continue;
-            }
             for (String kvPair : kvPairs) {
                 kvPair = kvPair.trim();
Index: trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java	(revision 18801)
@@ -1250,5 +1250,5 @@
             if (sc.getAssignedKey() == KeyEvent.CHAR_UNDEFINED) {
                 sc = null;
-        }
+            }
         }
 
Index: trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AbstractTableListEditor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AbstractTableListEditor.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AbstractTableListEditor.java	(revision 18801)
@@ -108,5 +108,5 @@
             TableCellEditor editor = table.getCellEditor();
             if (editor != null) {
-                ((DefaultCellEditor) editor).stopCellEditing();
+                editor.stopCellEditing();
             }
             if (entryList.getSelectedIndices().length != 1) {
Index: trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java	(revision 18801)
@@ -223,5 +223,5 @@
                     JOptionPane.showMessageDialog(gui, tr("Please select the row to delete."));
                 } else {
-                    Integer i;
+                    int i;
                     while ((i = list.getSelectedRow()) != -1) {
                         model.removeRow(i);
Index: trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryProvidersPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryProvidersPanel.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryProvidersPanel.java	(revision 18801)
@@ -515,5 +515,5 @@
         @Override
         public void actionPerformed(ActionEvent e) {
-            Integer i;
+            int i;
             while ((i = activeTable.getSelectedRow()) != -1) {
                 activeModel.removeRow(i);
Index: trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java	(revision 18801)
@@ -145,7 +145,7 @@
 
     /**
-     * Replies the list of selected plugin information objects
-     *
-     * @return the list of selected plugin information objects
+     * Replies the set of selected plugin information objects
+     *
+     * @return the set of selected plugin information objects
      */
     public Set<String> getSelectedPluginNames() {
@@ -264,8 +264,8 @@
 
     /**
-     * Replies the set of plugins which have been added by the user to
+     * Replies the list of plugins which have been added by the user to
      * the set of activated plugins.
      *
-     * @return the set of newly activated plugins
+     * @return the list of newly activated plugins
      */
     public List<PluginInformation> getNewlyActivatedPlugins() {
@@ -282,8 +282,8 @@
 
     /**
-     * Replies the set of plugins which have been removed by the user from
+     * Replies the list of plugins which have been removed by the user from
      * the set of deactivated plugins.
      *
-     * @return the set of newly deactivated plugins
+     * @return the list of newly deactivated plugins
      */
     public List<PluginInformation> getNewlyDeactivatedPlugins() {
@@ -295,7 +295,7 @@
 
     /**
-     * Replies the set of all available plugins.
-     *
-     * @return the set of all available plugins
+     * Replies the list of all available plugins.
+     *
+     * @return the list of all available plugins
      */
     public List<PluginInformation> getAvailablePlugins() {
Index: trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginUpdatePolicyPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginUpdatePolicyPanel.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginUpdatePolicyPanel.java	(revision 18801)
@@ -187,5 +187,5 @@
 
     /**
-     * Remebers the update policy preference settings on the JOSM preferences
+     * Remembers the update policy preference settings on the JOSM preferences
      */
     public void rememberInPreferences() {
Index: trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java	(revision 18801)
@@ -97,5 +97,5 @@
                     int i = field.getInt(null);
                     String s = KeyEvent.getKeyText(i);
-                    if (s != null && s.length() > 0 && !s.contains(unknown)) {
+                    if (s != null && !s.isEmpty() && !s.contains(unknown)) {
                         list.put(Integer.valueOf(i), s);
                     }
Index: trunk/src/org/openstreetmap/josm/gui/progress/ProgressMonitor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/progress/ProgressMonitor.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/progress/ProgressMonitor.java	(revision 18801)
@@ -76,8 +76,8 @@
 
     /**
-     * Can be used if method receive ProgressMonitor but it's not interested progress monitoring.
+     * Can be used if method receives ProgressMonitor, but it's not interested progress monitoring.
      * Basically replaces {@link #beginTask(String)} and {@link #finishTask()}
      *
-     * This method can be also used in finally section if method expects that some exception
+     * This method can be also used in finally section if method expects that some exceptions
      * might prevent it from passing progressMonitor away. If {@link #beginTask(String)} was
      * already called then this method does nothing.
Index: trunk/src/org/openstreetmap/josm/gui/progress/swing/PleaseWaitProgressMonitor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/progress/swing/PleaseWaitProgressMonitor.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/progress/swing/PleaseWaitProgressMonitor.java	(revision 18801)
@@ -107,5 +107,5 @@
 
     private void doInEDT(Runnable runnable) {
-        // This must be invoke later even if current thread is EDT because inside there is dialog.setVisible
+        // This must be invoked later even if current thread is EDT because inside there is dialog.setVisible
         // which freeze current code flow until modal dialog is closed
         SwingUtilities.invokeLater(() -> {
Index: trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java	(revision 18801)
@@ -531,6 +531,6 @@
     public List<String> getKeys() {
         return tags.stream()
-                .filter(tag -> !Utils.isStripEmpty(tag.getName()))
                 .map(TagModel::getName)
+                .filter(name -> !Utils.isStripEmpty(name))
                 .collect(Collectors.toList());
     }
Index: trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompEvent.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompEvent.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompEvent.java	(revision 18801)
@@ -5,5 +5,5 @@
 
 /**
- * This event is generated by an AutoCompTextField when an autocomplete occured.
+ * This event is generated by an AutoCompTextField when an autocomplete occurred.
  *
  * @see AutoCompTextField
Index: trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java	(revision 18801)
@@ -15,5 +15,4 @@
 import java.util.Objects;
 import java.util.Set;
-import java.util.function.Function;
 import java.util.stream.Collectors;
 
@@ -42,5 +41,4 @@
 import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset;
 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
-import org.openstreetmap.josm.gui.tagging.presets.items.Roles.Role;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
 import org.openstreetmap.josm.tools.MultiMap;
@@ -294,5 +292,5 @@
             for (TaggingPreset tp : presets) {
                 if (tp.roles != null) {
-                    list.add(Utils.transform(tp.roles.roles, (Function<Role, String>) x -> x.key), AutoCompletionPriority.IS_IN_STANDARD);
+                    list.add(Utils.transform(tp.roles.roles, x -> x.key), AutoCompletionPriority.IS_IN_STANDARD);
                 }
             }
@@ -427,5 +425,5 @@
      * @param keys the tag keys
      * @param comparator the custom comparator used to sort the list
-     * @return a set of tag values
+     * @return a list of tag values
      * @since 12859
      */
Index: trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItemGuiSupport.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItemGuiSupport.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItemGuiSupport.java	(revision 18801)
@@ -25,5 +25,5 @@
 
     private final Collection<OsmPrimitive> selected;
-    /** True if all selected primitives matched this preset at the moment it was openend. */
+    /** True if all selected primitives matched this preset at the moment it was opened. */
     private final boolean presetInitiallyMatches;
     private final Supplier<Collection<Tag>> changedTagsSupplier;
Index: trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java	(revision 18801)
@@ -11,5 +11,4 @@
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -154,5 +153,5 @@
      *      must be escaped within one entry
      * @param s the string
-     * @return splitted items
+     * @return split items
      */
     public static List<String> splitEscaped(char delimiter, String s) {
@@ -312,5 +311,5 @@
 
         if (values_sort && TaggingPresets.SORT_MENU.get()) {
-            Collections.sort(presetListEntries, (a, b) -> AlphanumComparator.getInstance().compare(a.getDisplayValue(), b.getDisplayValue()));
+            presetListEntries.sort((a, b) -> AlphanumComparator.getInstance().compare(a.getDisplayValue(), b.getDisplayValue()));
         }
     }
Index: trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetLink.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetLink.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetLink.java	(revision 18801)
@@ -46,5 +46,5 @@
 
     /**
-     * Creates a label to be inserted aboive this link
+     * Creates a label to be inserted above this link
      * @return a label
      */
Index: trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntry.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntry.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntry.java	(revision 18801)
@@ -76,5 +76,5 @@
      *
      * This is the contents that would be displayed in the current view plus a short description to
-     * aid the user.  The whole contents is wrapped to {@code width}.
+     * aid the user. The whole content is wrapped to {@code width}.
      *
      * @param width the width in px
@@ -83,5 +83,5 @@
     public String getListDisplay(int width) {
         String displayValue = getDisplayValue();
-        Integer count = getCount();
+        int count = getCount();
 
         if (count > 0 && cms.usage.getSelectedCount() > 1) {
Index: trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java	(revision 18801)
@@ -79,7 +79,5 @@
         keys.add(key);
         if (alternative_autocomplete_keys != null) {
-            for (String k : alternative_autocomplete_keys.split(",", -1)) {
-                keys.add(k);
-            }
+            Collections.addAll(keys, alternative_autocomplete_keys.split(",", -1));
         }
         getAllForKeys(keys).forEach(model::addElement);
@@ -270,5 +268,5 @@
      * Set the value template.
      * @param pattern The value_template pattern.
-     * @throws SAXException If an error occured while parsing.
+     * @throws SAXException If an error occurred while parsing.
      */
     public void setValue_template(String pattern) throws SAXException { // NOPMD
Index: trunk/src/org/openstreetmap/josm/gui/util/imagery/Vector3D.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/util/imagery/Vector3D.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/util/imagery/Vector3D.java	(revision 18801)
@@ -138,5 +138,5 @@
 
     /**
-     * Get the polar angle cossine (inclination)
+     * Get the polar angle cosine (inclination)
      *
      * @return The polar angle cosine
Index: trunk/src/org/openstreetmap/josm/gui/widgets/AbstractFileChooser.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/widgets/AbstractFileChooser.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/widgets/AbstractFileChooser.java	(revision 18801)
@@ -81,5 +81,5 @@
      * Returns a list of selected files if the file chooser is
      * set to allow multiple selection.
-     * @return a list of selected files if the file chooser is
+     * @return an array of selected files if the file chooser is
      * set to allow multiple selection, or an empty array otherwise.
      */
@@ -98,5 +98,5 @@
      * If false, the <code>AcceptAll</code> file filter is removed from
      * the list of available file filters.
-     * If true, the <code>AcceptAll</code> file filter will become the
+     * If true, the <code>AcceptAll</code> file filter will become
      * the actively used file filter.
      * @param b whether the <code>AcceptAll FileFilter</code> is used
Index: trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java	(revision 18801)
@@ -119,6 +119,6 @@
 
     /**
-     * Replies list of property change listeners.
-     * @return list of property change listeners
+     * Replies array of property change listeners.
+     * @return array of property change listeners
      */
     public PropertyChangeListener[] getPropertyChangeListeners() {
@@ -1065,5 +1065,6 @@
             StringBuilder sb = new StringBuilder("MultiSplitLayout.Split");
             sb.append(isRowLayout() ? " ROW [" : " COLUMN [")
-              .append(nChildren + ((nChildren == 1) ? " child" : " children"))
+              .append(nChildren)
+              .append((nChildren == 1) ? " child" : " children")
               .append("] ")
               .append(getBounds());
Index: trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java	(revision 18801)
@@ -265,5 +265,5 @@
      * <code>d</code> d is a date relative to the current time zone.
      *
-     * @param d the date . Must not be null.
+     * @param d the date. Must not be null.
      * @return the restricted changeset query
      * @throws IllegalArgumentException if d is null
@@ -570,5 +570,5 @@
          * see <a href="http://wiki.openstreetmap.org/wiki/API_v0.6#Query:_GET_.2Fapi.2F0.6.2Fchangesets">OSM API</a>.
          *
-         * Example for an query string:<br>
+         * Example for a query string:<br>
          * <pre>
          *    uid=1234&amp;open=true
Index: trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java	(revision 18801)
@@ -60,6 +60,6 @@
      * is defined <strong>at startup</strong>. It has no effect if the property is set
      * later by the application.
-     *
-     * We therefore read the property at class loading time and remember it's value.
+     * <p>
+     * We therefore read the property at class loading time and remember its value.
      */
     private static boolean jvmWillUseSystemProxies;
Index: trunk/src/org/openstreetmap/josm/io/DiffResultProcessor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/DiffResultProcessor.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/io/DiffResultProcessor.java	(revision 18801)
@@ -105,5 +105,5 @@
     /**
      * Postprocesses the diff result read and parsed from the server.
-     *
+     * <p>
      * Uploaded objects are assigned their new id (if they got assigned a new
      * id by the server), their new version (if the version was incremented),
Index: trunk/src/org/openstreetmap/josm/io/IGpxReader.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/IGpxReader.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/io/IGpxReader.java	(revision 18801)
@@ -33,6 +33,6 @@
 
     /**
-     * Returns the number of coordinates that have been successfuly read.
-     * @return the number of coordinates that have been successfuly read
+     * Returns the number of coordinates that have been successfully read.
+     * @return the number of coordinates that have been successfully read
      * @since 18179
      */
Index: trunk/src/org/openstreetmap/josm/io/OsmApi.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 18801)
@@ -809,5 +809,5 @@
                     errorHeader = response.getHeaderField("Error");
                     Logging.error("Error header: " + errorHeader);
-                } else if (retCode != HttpURLConnection.HTTP_OK && responseBody.length() > 0) {
+                } else if (retCode != HttpURLConnection.HTTP_OK && !responseBody.isEmpty()) {
                     Logging.error("Error body: " + responseBody);
                 }
@@ -815,5 +815,5 @@
 
                 errorHeader = errorHeader == null ? null : errorHeader.trim();
-                String errorBody = responseBody.length() == 0 ? null : responseBody.trim();
+                String errorBody = responseBody.isEmpty() ? null : responseBody.trim();
                 switch(retCode) {
                 case HttpURLConnection.HTTP_OK:
Index: trunk/src/org/openstreetmap/josm/io/OsmReader.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmReader.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/io/OsmReader.java	(revision 18801)
@@ -487,5 +487,5 @@
 
     /**
-     * Exception thrown after user cancelation.
+     * Exception thrown after user cancellation.
      */
     private static final class OsmParsingCanceledException extends XmlStreamParsingException implements ImportCancelException {
Index: trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java	(revision 18801)
@@ -509,5 +509,5 @@
                         }
                         // TODO should we handle also POST?
-                        if ("GET".equalsIgnoreCase(mode) && getMapUrl != null && !"".equals(getMapUrl)) {
+                        if ("GET".equalsIgnoreCase(mode) && getMapUrl != null && !getMapUrl.isEmpty()) {
                             try {
                                 String query = new URL(getMapUrl).getQuery();
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java	(revision 18801)
@@ -160,5 +160,5 @@
 
     /**
-     * Returns usage examples for the given command. To be overriden only my handlers that define several commands.
+     * Returns usage examples for the given command. To be overridden only my handlers that define several commands.
      * @param cmd The command asked
      * @return Usage examples for the given command
@@ -203,5 +203,5 @@
         if (GLOBAL_CONFIRMATION.get()) {
             // Ensure dialog box does not exceed main window size
-            Integer maxWidth = (int) Math.max(200, MainApplication.getMainFrame().getWidth()*0.6);
+            int maxWidth = (int) Math.max(200, MainApplication.getMainFrame().getWidth() * 0.6);
             String message = "<html><div>" + getPermissionMessage() +
                     "<br/>" + tr("Do you want to allow this?") + "</div></html>";
@@ -357,10 +357,9 @@
         DownloadParams result = new DownloadParams();
         if (args != null) {
-            result = result
-                .withNewLayer(isLoadInNewLayer())
-                .withLayerName(args.get("layer_name"))
-                .withLocked(get("layer_locked"))
-                .withDownloadPolicy(get("download_policy", DownloadPolicy::of, () -> DownloadPolicy.NORMAL))
-                .withUploadPolicy(get("upload_policy", UploadPolicy::of, () -> UploadPolicy.NORMAL));
+            result.withNewLayer(isLoadInNewLayer())
+                    .withLayerName(args.get("layer_name"))
+                    .withLocked(get("layer_locked"))
+                    .withDownloadPolicy(get("download_policy", DownloadPolicy::of, () -> DownloadPolicy.NORMAL))
+                    .withUploadPolicy(get("upload_policy", UploadPolicy::of, () -> UploadPolicy.NORMAL));
         }
         return result;
@@ -498,5 +497,5 @@
 
     /**
-     * Handler that takes an URL as parameter.
+     * Handler that takes a URL as a parameter.
      */
     public abstract static class RawURLParseRequestHandler extends RequestHandler {
Index: trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 18801)
@@ -14,5 +14,4 @@
 import java.awt.event.ActionEvent;
 import java.io.File;
-import java.io.FilenameFilter;
 import java.io.IOException;
 import java.net.MalformedURLException;
@@ -468,5 +467,5 @@
             long tim = System.currentTimeMillis();
             long last = Config.getPref().getLong("pluginmanager.lastupdate", 0);
-            Integer maxTime = Config.getPref().getInt("pluginmanager.time-based-update.interval", DEFAULT_TIME_BASED_UPDATE_INTERVAL);
+            int maxTime = Config.getPref().getInt("pluginmanager.time-based-update.interval", DEFAULT_TIME_BASED_UPDATE_INTERVAL);
             long d = TimeUnit.MILLISECONDS.toDays(tim - last);
             if ((last <= 0) || (maxTime <= 0)) {
@@ -977,5 +976,5 @@
      *
      * @param monitor the progress monitor. Defaults to {@link NullProgressMonitor#INSTANCE} if null.
-     * @return the list of locally available plugin information, null in case of errors
+     * @return the map of locally available plugin information, null in case of errors
      *
      */
@@ -1028,5 +1027,5 @@
 
     /**
-     * Builds the set of plugins to load. Deprecated and unmaintained plugins are filtered
+     * Builds the list of plugins to load. Deprecated and unmaintained plugins are filtered
      * out. This involves user interaction. This method displays alert and confirmation
      * messages.
@@ -1034,5 +1033,5 @@
      * @param parent The parent component to be used for the displayed dialog
      * @param monitor the progress monitor. Defaults to {@link NullProgressMonitor#INSTANCE} if null.
-     * @return the set of plugins to load (as set of plugin names)
+     * @return the list of plugins to load (as set of plugin names)
      */
     public static List<PluginInformation> buildListOfPluginsToLoad(Component parent, ProgressMonitor monitor) {
@@ -1349,5 +1348,5 @@
             return;
 
-        final File[] files = pluginDir.listFiles((FilenameFilter) (dir, name) -> name.endsWith(".jar.new"));
+        final File[] files = pluginDir.listFiles((dir, name) -> name.endsWith(".jar.new"));
         if (files == null)
             return;
Index: trunk/src/org/openstreetmap/josm/tools/ColorScale.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ColorScale.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/tools/ColorScale.java	(revision 18801)
@@ -249,5 +249,5 @@
         fh = fm.getHeight()/2;
         if (colorBarTitles != null && colorBarTitles.length > 0) {
-             fw = Arrays.asList(colorBarTitles).stream().mapToInt(title -> fm.stringWidth(title)).max().orElse(50);
+             fw = Arrays.stream(colorBarTitles).mapToInt(fm::stringWidth).max().orElse(50);
         } else {
             fw = fm.stringWidth(
Index: trunk/src/org/openstreetmap/josm/tools/Destroyable.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Destroyable.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/tools/Destroyable.java	(revision 18801)
@@ -4,5 +4,5 @@
 /**
  * Some objects like layers (when they are removed) or the whole map frame (when the last layer has
- * been removed) have an definite set of actions to execute. This is the "destructor" interface called
+ * been removed) have a definite set of actions to execute. This is the "destructor" interface called
  * on those objects.
  *
Index: trunk/src/org/openstreetmap/josm/tools/Geometry.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Geometry.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/tools/Geometry.java	(revision 18801)
@@ -97,5 +97,5 @@
      *              Will be filled with commands that add intersection nodes to
      *              the ways.
-     * @return list of new nodes, if test is true the list might not contain all intersections
+     * @return set of new nodes, if test is true the list might not contain all intersections
      */
     public static Set<Node> addIntersections(List<Way> ways, boolean test, List<Command> cmds) {
@@ -131,5 +131,5 @@
                 List<Node> way2Nodes = newNodes[seg2Way];
 
-                //iterate over primary segmemt
+                //iterate over primary segment
                 for (int seg1Pos = 0; seg1Pos + 1 < way1Nodes.size(); seg1Pos++) {
 
@@ -351,5 +351,5 @@
 
     /**
-     * Get the segment segment intersection of two line segments
+     * Get the segment-segment intersection of two line segments
      * @param x1 The x coordinate of the first point (first segment)
      * @param y1 The y coordinate of the first point (first segment)
@@ -833,5 +833,5 @@
         if (osm instanceof Way && ((Way) osm).isClosed()) {
             return closedWayArea((Way) osm);
-        } else if (osm instanceof Relation && ((Relation) osm).isMultipolygon() && !((Relation) osm).hasIncompleteMembers()) {
+        } else if (osm instanceof Relation && osm.isMultipolygon() && !((Relation) osm).hasIncompleteMembers()) {
             return multipolygonArea((Relation) osm);
         } else {
@@ -922,5 +922,5 @@
 
     /**
-     * Get angles in radians and return it's value in range [0, 180].
+     * Get angles in radians and return its value in range [0, 180].
      *
      * @param angle the angle in radians
@@ -993,5 +993,5 @@
 
     /**
-     * Compute center of the circle closest to different nodes.
+     * Compute the center of the circle closest to different nodes.
      *
      * Ensure exact center computation in case nodes are already aligned in circle.
Index: trunk/src/org/openstreetmap/josm/tools/GuiSizesHelper.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/GuiSizesHelper.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/tools/GuiSizesHelper.java	(revision 18801)
@@ -11,5 +11,5 @@
  * Support class to handle size information of Gui elements
  * This is needed, because display resolution may vary a lot and a common set
- * of sizes wont work for all users alike.
+ * of sizes won't work for all users alike.
  * @since 12682 (moved from {@code gui.util} package)
  * @since 10358
@@ -22,5 +22,5 @@
 
     /** cache value for screen resolution */
-    private static float screenDPI = -1;
+    private static volatile float screenDPI = -1;
 
     /**
Index: trunk/src/org/openstreetmap/josm/tools/HttpClient.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/HttpClient.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/tools/HttpClient.java	(revision 18801)
@@ -36,5 +36,5 @@
 
 /**
- * Provides a uniform access for a HTTP/HTTPS server. This class should be used in favour of {@link HttpURLConnection}.
+ * Provides uniform access for a HTTP/HTTPS server. This class should be used in favour of {@link HttpURLConnection}.
  * @since 9168
  */
Index: trunk/src/org/openstreetmap/josm/tools/OptionParser.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/OptionParser.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/tools/OptionParser.java	(revision 18801)
@@ -280,5 +280,5 @@
 
         /**
-         * Called once if the parameter is encountered, afer basic validation.
+         * Called once if the parameter is encountered, after basic validation.
          * @param parameter The parameter if {@link #requiresParameter()} is true, <code>null</code> otherwise.
          */
Index: trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java	(revision 18801)
@@ -487,5 +487,5 @@
                         Logging.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value);
                     }
-                    w.append(key + '=' + value + '\n');
+                    w.append(key).append('=').append(value).append('\n');
                 }
                 w.append('\n');
@@ -500,5 +500,5 @@
                         Logging.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value);
                     }
-                    w.append(key + '=' + value + '\n');
+                    w.append(key).append('=').append(value).append('\n');
                 }
                 w.append('\n');
Index: trunk/src/org/openstreetmap/josm/tools/Shortcut.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Shortcut.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/tools/Shortcut.java	(revision 18801)
@@ -267,5 +267,5 @@
         if (keyStroke == null) return "";
         String modifText = KeyEvent.getModifiersExText(keyStroke.getModifiers());
-        if ("".equals(modifText)) return KeyEvent.getKeyText(keyStroke.getKeyCode());
+        if (modifText.isEmpty()) return KeyEvent.getKeyText(keyStroke.getKeyCode());
         return modifText + '+' + KeyEvent.getKeyText(keyStroke.getKeyCode());
     }
@@ -522,5 +522,5 @@
     private static Shortcut registerShortcut(String shortText, String longText, int requestedKey, int requestedGroup, Integer modifier) {
         doInit();
-        Integer defaultModifier = findModifier(requestedGroup, modifier);
+        int defaultModifier = findModifier(requestedGroup, modifier);
         final Optional<Shortcut> existing = findShortcutByKeyOrShortText(requestedKey, defaultModifier, shortText);
         if (existing.isPresent() && shortText.equals(existing.get().getShortText())) {
Index: trunk/src/org/openstreetmap/josm/tools/Territories.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Territories.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/tools/Territories.java	(revision 18801)
@@ -200,6 +200,6 @@
                     for (JsonValue feature : json.getObject().getJsonArray("features")) {
                         ofNullable(feature.asJsonObject().getJsonObject("properties")).ifPresent(props ->
-                        ofNullable(props.getJsonObject("urls")).ifPresent(urls ->
-                        ofNullable(urls.getString(TAGINFO)).ifPresent(taginfo -> {
+                        ofNullable(props.getJsonObject("urls")).flatMap(urls ->
+                        ofNullable(urls.getString(TAGINFO))).ifPresent(taginfo -> {
                             JsonArray iso1 = props.getJsonArray(ISO3166_1_LC);
                             JsonArray iso2 = props.getJsonArray(ISO3166_2_LC);
@@ -209,5 +209,5 @@
                                 readExternalTaginfo(taginfoGeofabrikCache, taginfo, iso2, source);
                             }
-                        })));
+                        }));
                     }
                 }
Index: trunk/src/org/openstreetmap/josm/tools/TextAnalyzer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/TextAnalyzer.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/tools/TextAnalyzer.java	(revision 18801)
@@ -82,5 +82,5 @@
                     s.append(c); // just add ", not open
                 } else {
-                    s.delete(0, s.length()); // forget that empty characthers and start reading "....
+                    s.delete(0, s.length()); // forget that empty characters and start reading "....
                     quotesStarted = true;
                 }
Index: trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 18801)
@@ -174,12 +174,13 @@
 
     /**
-     * Return the modulus in the range [0, n)
-     * @param a dividend
-     * @param n divisor
-     * @return modulo (remainder of the Euclidian division of a by n)
+     * Returns the modulo in the range [0, n) for the given dividend and divisor.
+     * @param a the dividend
+     * @param n the divisor
+     * @return the modulo, which is the remainder of the Euclidean division of a by n, in the range [0, n)
+     * @throws IllegalArgumentException if n is less than or equal to 0
      */
     public static int mod(int a, int n) {
         if (n <= 0)
-            throw new IllegalArgumentException("n must be <= 0 but is "+n);
+            throw new IllegalArgumentException("n must be <= 0 but is " + n);
         int res = a % n;
         if (res < 0) {
@@ -290,5 +291,5 @@
      * @param in The source directory
      * @param out The destination directory
-     * @throws IOException if any I/O error ooccurs
+     * @throws IOException if any I/O error occurs
      * @throws IllegalArgumentException if {@code in} or {@code out} is {@code null}
      * @since 7835
@@ -1005,5 +1006,5 @@
 
     /**
-     * Cast an object savely.
+     * Cast an object safely.
      * @param <T> the target type
      * @param o the object to cast
@@ -1088,5 +1089,5 @@
      * @param <T> type of elements
      * @param elements collection to shorten
-     * @param maxElements maximum number of elements to keep (including including the {@code overflowIndicator})
+     * @param maxElements maximum number of elements to keep (including the {@code overflowIndicator})
      * @param overflowIndicator the element used to indicate that the collection has been shortened
      * @return the shortened collection
@@ -1762,5 +1763,5 @@
         int pPos = version.indexOf('+');
         try {
-            return Integer.parseInt(version.substring(bPos > -1 ? bPos + 1 : pPos + 1, version.length()));
+            return Integer.parseInt(version.substring(bPos > -1 ? bPos + 1 : pPos + 1));
         } catch (NumberFormatException e) {
             Logging.trace(e);
@@ -1828,5 +1829,5 @@
     /**
      * Determines if a class can be found for the given name.
-     * @param className class nmae to find
+     * @param className class name to find
      * @return {@code true} if the class can be found, {@code false} otherwise
      * @since 17692
@@ -1921,5 +1922,5 @@
 
     /**
-     * Convenient method to open an URL stream, using JOSM HTTP client if neeeded.
+     * Convenient method to open an URL stream, using JOSM HTTP client if needed.
      * @param url URL for reading from
      * @return an input stream for reading from the URL
Index: trunk/src/org/openstreetmap/josm/tools/WikiReader.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/WikiReader.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/tools/WikiReader.java	(revision 18801)
@@ -137,5 +137,5 @@
                 // add a border="0" attribute to images, otherwise the internal help browser
                 // will render a thick  border around images inside an <a> element
-                // remove width information to avoid distorded images (fix #11262)
+                // remove width information to avoid distorted images (fix #11262)
                 b.append(line.replace("<img ", "<img border=\"0\" ")
                          .replaceAll("width=\"(\\d+)\"", "")
Index: trunk/src/org/openstreetmap/josm/tools/template_engine/TemplateParser.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/template_engine/TemplateParser.java	(revision 18797)
+++ trunk/src/org/openstreetmap/josm/tools/template_engine/TemplateParser.java	(revision 18801)
@@ -5,6 +5,6 @@
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
@@ -21,6 +21,6 @@
     private final Tokenizer tokenizer;
 
-    private static final Collection<TokenType> EXPRESSION_END_TOKENS = Arrays.asList(TokenType.EOF);
-    private static final Collection<TokenType> CONDITION_WITH_APOSTROPHES_END_TOKENS = Arrays.asList(TokenType.APOSTROPHE);
+    private static final Collection<TokenType> EXPRESSION_END_TOKENS = Collections.singletonList(TokenType.EOF);
+    private static final Collection<TokenType> CONDITION_WITH_APOSTROPHES_END_TOKENS = Collections.singletonList(TokenType.APOSTROPHE);
 
     /**
