Index: /trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java	(revision 7720)
+++ /trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java	(revision 7721)
@@ -167,33 +167,5 @@
         if (!w.isUsable())
             return;
-        List<Node> wNodes = w.getNodes();                            // The original list of nodes for this way
-        List<Node> wNodesToUse = new ArrayList<>(wNodes.size()); // The list that will be considered for this test
-        if (w.isClosed()) {
-            // In case of a closed way, build the list of lat/lon starting from the node with the lowest id
-            // to ensure this list will produce the same hashcode as the list obtained from another closed
-            // way with the same nodes, in the same order, but that does not start from the same node (fix #8008)
-            int lowestIndex = 0;
-            long lowestNodeId = wNodes.get(0).getUniqueId();
-            for (int i=1; i<wNodes.size(); i++) {
-                if (wNodes.get(i).getUniqueId() < lowestNodeId) {
-                    lowestNodeId = wNodes.get(i).getUniqueId();
-                    lowestIndex = i;
-                }
-            }
-            for (int i=lowestIndex; i<wNodes.size()-1; i++) {
-                wNodesToUse.add(wNodes.get(i));
-            }
-            for (int i=0; i<lowestIndex; i++) {
-                wNodesToUse.add(wNodes.get(i));
-            }
-            wNodesToUse.add(wNodes.get(lowestIndex));
-        } else {
-            wNodesToUse.addAll(wNodes);
-        }
-        // Build the list of lat/lon
-        List<LatLon> wLat = new ArrayList<>(wNodesToUse.size());
-        for (Node node : wNodesToUse) {
-            wLat.add(node.getCoor());
-        }
+        List<LatLon> wLat = getOrderedNodes(w);
         // If this way has not direction-dependant keys, make sure the list is ordered the same for all ways (fix #8015)
         if (!w.hasDirectionKeys()) {
@@ -201,5 +173,5 @@
             if (!knownHashCodes.contains(hash)) {
                 List<LatLon> reversedwLat = new ArrayList<>(wLat);
-                   Collections.reverse(reversedwLat);
+                Collections.reverse(reversedwLat);
                 int reverseHash = reversedwLat.hashCode();
                 if (!knownHashCodes.contains(reverseHash)) {
@@ -218,4 +190,43 @@
         WayPairNoTags wKeyN = new WayPairNoTags(wLat);
         waysNoTags.put(wKeyN, w);
+    }
+
+    /**
+     * Replies the ordered list of nodes of way w such as it is easier to find duplicated ways.
+     * In case of a closed way, build the list of lat/lon starting from the node with the lowest id
+     * to ensure this list will produce the same hashcode as the list obtained from another closed
+     * way with the same nodes, in the same order, but that does not start from the same node (fix #8008)
+     * @param w way
+     * @return the ordered list of nodes of way w such as it is easier to find duplicated ways
+     * @since 7721
+     */
+    public static List<LatLon> getOrderedNodes(Way w) {
+        List<Node> wNodes = w.getNodes();                        // The original list of nodes for this way
+        List<Node> wNodesToUse = new ArrayList<>(wNodes.size()); // The list that will be considered for this test
+        if (w.isClosed()) {
+            int lowestIndex = 0;
+            long lowestNodeId = wNodes.get(0).getUniqueId();
+            for (int i=1; i<wNodes.size(); i++) {
+                if (wNodes.get(i).getUniqueId() < lowestNodeId) {
+                    lowestNodeId = wNodes.get(i).getUniqueId();
+                    lowestIndex = i;
+                }
+            }
+            for (int i=lowestIndex; i<wNodes.size()-1; i++) {
+                wNodesToUse.add(wNodes.get(i));
+            }
+            for (int i=0; i<lowestIndex; i++) {
+                wNodesToUse.add(wNodes.get(i));
+            }
+            wNodesToUse.add(wNodes.get(lowestIndex));
+        } else {
+            wNodesToUse.addAll(wNodes);
+        }
+        // Build the list of lat/lon
+        List<LatLon> wLat = new ArrayList<>(wNodesToUse.size());
+        for (Node node : wNodesToUse) {
+            wLat.add(node.getCoor());
+        }
+        return wLat;
     }
 
