Index: trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java	(revision 12164)
+++ trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java	(revision 12165)
@@ -108,7 +108,7 @@
             }
         }
-        privateTracks.addAll(other.getTracks());
-        privateRoutes.addAll(other.getRoutes());
-        privateWaypoints.addAll(other.getWaypoints());
+        other.getTracks().forEach(this::addTrack);
+        other.getRoutes().forEach(this::addRoute);
+        other.getWaypoints().forEach(this::addWaypoint);
         dataSources.addAll(other.dataSources);
         fireInvalidate();
@@ -129,5 +129,5 @@
      */
     public void addTrack(GpxTrack track) {
-        if (privateTracks.contains(track)) {
+        if (privateTracks.stream().anyMatch(t -> t == track)) {
             throw new IllegalArgumentException(MessageFormat.format("The track was already added to this data: {0}", track));
         }
@@ -143,5 +143,5 @@
      */
     public void removeTrack(GpxTrack track) {
-        if (!privateTracks.remove(track)) {
+        if (!privateTracks.removeIf(t -> t == track)) {
             throw new IllegalArgumentException(MessageFormat.format("The track was not in this data: {0}", track));
         }
@@ -165,5 +165,5 @@
      */
     public void addRoute(GpxRoute route) {
-        if (privateRoutes.contains(route)) {
+        if (privateRoutes.stream().anyMatch(r -> r == route)) {
             throw new IllegalArgumentException(MessageFormat.format("The route was already added to this data: {0}", route));
         }
@@ -178,5 +178,5 @@
      */
     public void removeRoute(GpxRoute route) {
-        if (!privateRoutes.remove(route)) {
+        if (!privateRoutes.removeIf(r -> r == route)) {
             throw new IllegalArgumentException(MessageFormat.format("The route was not in this data: {0}", route));
         }
@@ -199,5 +199,5 @@
      */
     public void addWaypoint(WayPoint waypoint) {
-        if (privateWaypoints.contains(waypoint)) {
+        if (privateWaypoints.stream().anyMatch(w -> w == waypoint)) {
             throw new IllegalArgumentException(MessageFormat.format("The route was already added to this data: {0}", waypoint));
         }
@@ -212,5 +212,5 @@
      */
     public void removeWaypoint(WayPoint waypoint) {
-        if (!privateWaypoints.remove(waypoint)) {
+        if (!privateWaypoints.removeIf(w -> w == waypoint)) {
             throw new IllegalArgumentException(MessageFormat.format("The route was not in this data: {0}", waypoint));
         }
@@ -580,8 +580,8 @@
         final int prime = 31;
         int result = 1;
-        result = prime * result + dataSources.hashCode();
-        result = prime * result + privateRoutes.hashCode();
-        result = prime * result + privateTracks.hashCode();
-        result = prime * result + privateWaypoints.hashCode();
+        result = prime * result + ((dataSources == null) ? 0 : dataSources.hashCode());
+        result = prime * result + ((privateRoutes == null) ? 0 : privateRoutes.hashCode());
+        result = prime * result + ((privateTracks == null) ? 0 : privateTracks.hashCode());
+        result = prime * result + ((privateWaypoints == null) ? 0 : privateWaypoints.hashCode());
         return result;
     }
