IdentitySet.st
changeset 14018 351ab0fb005d
parent 14016 8ffb0772c512
child 14655 1d2b0650e086
--- a/IdentitySet.st	Wed Feb 22 12:07:54 2012 +0100
+++ b/IdentitySet.st	Wed Feb 22 13:54:31 2012 +0100
@@ -58,14 +58,6 @@
     "
      #(1 2 3 4 5 6 7) asSet copyWithout:5
     "
-!
-
-copyWithoutAll:aCollection
-    ^ self reject:[:each | (aCollection includesIdentical:each)]
-
-    "
-     #(1 2 3 4 5 6 7) asSet copyWithoutAll:#(3 5 7 9)
-    "
 ! !
 
 !IdentitySet methodsFor:'adding & removing'!
@@ -169,6 +161,30 @@
     "Created: 19.3.1997 / 15:18:59 / cg"
 ! !
 
+!IdentitySet methodsFor:'set operations'!
+
+\ aCollection
+    "return a new set containing all elements of the receiver, 
+     which are NOT also contained in the aCollection
+     For large collections you better use a Set for aCollection.
+     Redefined here to do identity comparison."
+
+    |newCollection|
+
+    newCollection := self speciesForAdding new.
+    self do:[:element |
+        (aCollection includesIdentical:element) ifFalse:[
+            newCollection add:element
+        ]
+    ].
+    ^ newCollection
+
+    "
+     #(0 1 2 3 4 5 6 7 8 9) asIdentitySet \ #(1 2 3) asSet  
+     #(0 1 2 3 4 5 6 7 8 9) asIdentitySet \ #(1 2 3)
+    "
+! !
+
 !IdentitySet methodsFor:'testing'!
 
 identicalContentsAs:aCollection
@@ -201,5 +217,5 @@
 !IdentitySet class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/IdentitySet.st,v 1.32 2012-02-22 11:07:43 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/IdentitySet.st,v 1.33 2012-02-22 12:54:31 stefan Exp $'
 ! !