Index: trunk/src/org/openstreetmap/josm/data/APIDataSet.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/APIDataSet.java	(revision 2187)
+++ trunk/src/org/openstreetmap/josm/data/APIDataSet.java	(revision 2188)
@@ -28,5 +28,4 @@
  * The collection is derived from the modified primitives of an {@see DataSet}.
  * 
- * 
  */
 public class APIDataSet {
@@ -45,7 +44,7 @@
 
     /**
-     * initializes the API data set with the modified primitives in <code>ds</ds>
-     * 
-     * @param ds the data set. Ignore, if null.
+     * initializes the API data set with the modified primitives in <code>ds</code>
+     * 
+     * @param ds the data set. Ignored, if null.
      */
     public void init(DataSet ds) {
@@ -63,5 +62,5 @@
             } else if (osm.isModified() && !osm.isDeleted()) {
                 toUpdate.addLast(osm);
-            } else if (osm.isDeleted() && osm.getId() != 0) {
+            } else if (osm.isDeleted() && osm.getId() != 0 && osm.isModified()) {
                 toDelete.addFirst(osm);
             }
@@ -70,7 +69,7 @@
 
     /**
-     * initializes the API data set with the modified primitives in <code>ds</ds>
-     * 
-     * @param ds the data set. Ignore, if null.
+     * initializes the API data set with the modified primitives in <code>ds</code>
+     * 
+     * @param ds the data set. Ignored, if null.
      */
     public APIDataSet(DataSet ds) {
Index: trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 2187)
+++ trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 2188)
@@ -35,6 +35,17 @@
 abstract public class OsmPrimitive implements Comparable<OsmPrimitive>, Tagged {
 
+    /**
+     * Replies the sub-collection of {@see OsmPrimitive}s of type <code>type</code> present in
+     * another collection of {@see OsmPrimitive}s. The result collection is a list.
+     * 
+     * If <code>list</code> is null, replies an empty list.
+     * 
+     * @param <T>
+     * @param list  the original list
+     * @param type the type to filter for
+     * @return the sub-list of OSM primitives of type <code>type</code>
+     */
     static public <T extends OsmPrimitive>  List<T> getFilteredList(Collection<OsmPrimitive> list, Class<T> type) {
-        if (list == null) return null;
+        if (list == null) return Collections.emptyList();
         List<T> ret = new LinkedList<T>();
         for(OsmPrimitive p: list) {
@@ -46,6 +57,17 @@
     }
 
+    /**
+     * Replies the sub-collection of {@see OsmPrimitive}s of type <code>type</code> present in
+     * another collection of {@see OsmPrimitive}s. The result collection is a set.
+     * 
+     * If <code>list</code> is null, replies an empty set.
+     * 
+     * @param <T>
+     * @param list  the original collection
+     * @param type the type to filter for
+     * @return the sub-set of OSM primitives of type <code>type</code>
+     */
     static public <T extends OsmPrimitive>  Set<T> getFilteredSet(Collection<OsmPrimitive> set, Class<T> type) {
-        if (set == null) return null;
+        if (set == null) return Collections.emptySet();
         HashSet<T> ret = new HashSet<T>();
         for(OsmPrimitive p: set) {
@@ -91,9 +113,4 @@
      * An id of 0 means an unknown id. The object has not been uploaded yet to
      * know what id it will get.
-     *
-     * Do not write to this attribute except you know exactly what you are doing.
-     * More specific, it is not good to set this to 0 and think the object is now
-     * new to the server! To create a new object, call the default constructor of
-     * the respective class.
      *
      */
@@ -742,6 +759,3 @@
      */
     public abstract String getDisplayName(NameFormatter formatter);
-
 }
-
-
