Index: src/org/openstreetmap/josm/data/osm/WaySegment.java
===================================================================
--- src/org/openstreetmap/josm/data/osm/WaySegment.java	(révision 5779)
+++ src/org/openstreetmap/josm/data/osm/WaySegment.java	(copie de travail)
@@ -4,7 +4,7 @@
 /**
  * A segment consisting of 2 consecutive nodes out of a way.
  */
-public final class WaySegment {
+public final class WaySegment implements Comparable<WaySegment> {
     /**
      * The way.
      */
@@ -49,4 +49,9 @@
     @Override public int hashCode() {
         return way.hashCode() ^ lowerIndex;
     }
+
+    @Override
+    public int compareTo(WaySegment o) {
+        return this.toWay().compareTo(o.toWay());
+    }
 }
Index: src/org/openstreetmap/josm/data/validation/TestError.java
===================================================================
--- src/org/openstreetmap/josm/data/validation/TestError.java	(révision 5779)
+++ src/org/openstreetmap/josm/data/validation/TestError.java	(copie de travail)
@@ -13,12 +13,13 @@
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.data.osm.WaySegment;
+import org.openstreetmap.josm.data.validation.util.MultipleNameVisitor;
 
 /**
  * Validation error
  * @author frsantos
  */
-public class TestError {
+public class TestError implements Comparable<TestError> {
     /** is this error on the ignore list */
     private Boolean ignored = false;
     /** Severity */
@@ -276,4 +277,15 @@
     public Collection<?> getHighlighted() {
         return highlighted;
     }
+
+    @Override
+    public int compareTo(TestError o) {
+        MultipleNameVisitor v1 = new MultipleNameVisitor();
+        MultipleNameVisitor v2 = new MultipleNameVisitor();
+
+        v1.visit(getPrimitives());
+        v2.visit(o.getPrimitives());
+        return v1.toString().compareToIgnoreCase(v2.toString());
+    }
+
 }
Index: src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java
===================================================================
--- src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java	(révision 5779)
+++ src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java	(copie de travail)
@@ -6,10 +6,10 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.TreeSet;
 
 import org.openstreetmap.josm.command.ChangeCommand;
 import org.openstreetmap.josm.command.Command;
@@ -191,14 +191,14 @@
     @Override
     public void endTest() {
         super.endTest();
-        for(LinkedHashSet<OsmPrimitive> duplicated : relations.values()) {
+        for(TreeSet<OsmPrimitive> duplicated : relations.values()) {
             if (duplicated.size() > 1) {
                 TestError testError = new TestError(this, Severity.ERROR, tr("Duplicated relations"), DUPLICATE_RELATION, duplicated);
                 errors.add( testError );
             }
         }
         relations = null;
-        for(LinkedHashSet<OsmPrimitive> duplicated : relations_nokeys.values()) {
+        for(TreeSet<OsmPrimitive> duplicated : relations_nokeys.values()) {
             if (duplicated.size() > 1) {
                 TestError testError = new TestError(this, Severity.WARNING, tr("Relations with same members"), SAME_RELATION, duplicated);
                 errors.add( testError );
@@ -213,8 +213,9 @@
             return;
         List<RelationMember> rMembers = r.getMembers();
         Map<String, String> rkeys = r.getKeys();
-        for (String key : ignoreKeys)
+        for (String key : ignoreKeys) {
             rkeys.remove(key);
+        }
         RelationPair rKey = new RelationPair(rMembers, rkeys);
         relations.put(rKey, r);
         relations_nokeys.put(rMembers, r);
@@ -289,7 +290,7 @@
     @Override
     public boolean isFixable(TestError testError) {
         if (!(testError.getTester() instanceof DuplicateRelation)
-            || testError.getCode() == SAME_RELATION) return false;
+                || testError.getCode() == SAME_RELATION) return false;
 
         // We fix it only if there is no more than one relation that is relation member.
         Collection<? extends OsmPrimitive> sel = testError.getPrimitives();
Index: src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java
===================================================================
--- src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java	(révision 5779)
+++ src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java	(copie de travail)
@@ -6,9 +6,9 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.TreeSet;
 
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -55,9 +55,9 @@
 
     @Override
     public void endTest() {
-        Map<List<Way>, LinkedHashSet<WaySegment>> ways_seen = new HashMap<List<Way>, LinkedHashSet<WaySegment>>(500);
+        Map<List<Way>, TreeSet<WaySegment>> ways_seen = new HashMap<List<Way>, TreeSet<WaySegment>>(500);
 
-        for (LinkedHashSet<WaySegment> duplicated : nodePairs.values()) {
+        for (TreeSet<WaySegment> duplicated : nodePairs.values()) {
             int ways = duplicated.size();
 
             if (ways > 1) {
Index: src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
===================================================================
--- src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java	(révision 5779)
+++ src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java	(copie de travail)
@@ -8,11 +8,11 @@
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.TreeSet;
 
 import javax.swing.JTree;
 import javax.swing.ToolTipManager;
@@ -205,7 +206,7 @@
                 expandedPaths.add(new TreePath(new Object[] { rootNode, severityNode }));
             }
 
-            for (Entry<String, LinkedHashSet<TestError>> msgErrors : severityErrors.entrySet()) {
+            for (Entry<String, TreeSet<TestError>> msgErrors : severityErrors.entrySet()) {
                 // Message node
                 Set<TestError> errs = msgErrors.getValue();
                 String msg = msgErrors.getKey() + " (" + errs.size() + ")";
@@ -235,7 +236,7 @@
                     }
                 }
 
-                for (Entry<String, LinkedHashSet<TestError>> msgErrors : errorlist.entrySet()) {
+                for (Entry<String, TreeSet<TestError>> msgErrors : errorlist.entrySet()) {
                     // Message node
                     Set<TestError> errs = msgErrors.getValue();
                     String msg;
Index: src/org/openstreetmap/josm/tools/MultiMap.java
===================================================================
--- src/org/openstreetmap/josm/tools/MultiMap.java	(révision 5779)
+++ src/org/openstreetmap/josm/tools/MultiMap.java	(copie de travail)
@@ -4,11 +4,11 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.TreeSet;
 
 /**
  * MultiMap - maps keys to multiple values
@@ -19,14 +19,14 @@
  */
 public class MultiMap<A, B> {
 
-    private final Map<A, LinkedHashSet<B>> map;
+    private final Map<A, TreeSet<B>> map;
 
     public MultiMap() {
-        map = new HashMap<A, LinkedHashSet<B>>();
+        map = new HashMap<A, TreeSet<B>>();
     }
 
     public MultiMap(int capacity) {
-        map = new HashMap<A, LinkedHashSet<B>>(capacity);
+        map = new HashMap<A, TreeSet<B>>(capacity);
     }
 
     /**
@@ -35,9 +35,9 @@
      * Can be called multiple times with the same key, but different value.
      */
     public void put(A key, B value) {
-        LinkedHashSet<B> vals = map.get(key);
+        TreeSet<B> vals = map.get(key);
         if (vals == null) {
-            vals = new LinkedHashSet<B>();
+            vals = new TreeSet<B>();
             map.put(key, vals);
         }
         vals.add(value);
@@ -52,7 +52,7 @@
     public void putVoid(A key) {
         if (map.containsKey(key))
             return;
-        map.put(key, new LinkedHashSet<B>());
+        map.put(key, new TreeSet<B>());
     }
 
     /**
@@ -61,9 +61,9 @@
      * Adds to the mappings that are already there.
      */
     public void putAll(A key, Collection<B> values) {
-        LinkedHashSet<B> vals = map.get(key);
+        TreeSet<B> vals = map.get(key);
         if (vals == null) {
-            vals = new LinkedHashSet<B>(values);
+            vals = new TreeSet<B>(values);
             map.put(key, vals);
         }
         vals.addAll(values);
@@ -90,9 +90,9 @@
     /**
      * Like get, but returns an empty Set if nothing has been mapped to the key.
      */
-    public LinkedHashSet<B> getValues(A key) {
+    public TreeSet<B> getValues(A key) {
         if (!map.containsKey(key))
-            return new LinkedHashSet<B>();
+            return new TreeSet<B>();
         return map.get(key);
     }
 
@@ -120,7 +120,7 @@
         map.clear();
     }
 
-    public Set<Entry<A, LinkedHashSet<B>>> entrySet() {
+    public Set<Entry<A, TreeSet<B>>> entrySet() {
         return map.entrySet();
     }
 
@@ -134,7 +134,7 @@
     /**
      * Returns a collection of all value sets.
      */
-    public Collection<LinkedHashSet<B>> values() {
+    public Collection<TreeSet<B>> values() {
         return map.values();
     }
 
@@ -145,19 +145,19 @@
      */
     public boolean remove(A key, B value) {
         Set<B> values = get(key);
-        if (values != null) {
+        if (values != null)
             return values.remove(value);
-        }
         return false;
     }
 
     /**
      * Removes all mappings for a certain key.
      */
-    public LinkedHashSet<B> remove(A key) {
+    public TreeSet<B> remove(A key) {
         return map.remove(key);
     }
 
+    @Override
     public String toString() {
         List<String> entries = new ArrayList<String>(map.size());
         for (A key : map.keySet()) {
