added: #symmetricDifference:
authorClaus Gittinger <cg@exept.de>
Tue, 03 Nov 2009 21:02:27 +0100
changeset 12429 7f0b22f1f37c
parent 12428 2a6ac9878399
child 12430 b42fb161fca5
added: #symmetricDifference:
Collection.st
--- a/Collection.st	Tue Nov 03 20:52:57 2009 +0100
+++ b/Collection.st	Tue Nov 03 21:02:27 2009 +0100
@@ -3211,6 +3211,23 @@
     "
 !
 
+symmetricDifference:aCollection
+    "return a new set containing all elements, 
+     which are contained in either the receiver or aCollection, but not in both.
+     Same as xor: - for compatibility"
+
+    ^ self xor:aCollection
+
+    "
+     |c1 c2|
+
+     c1 := #( foo bar baz baloo ).
+     c2 := #( foe bar banana baloo ).
+     c1 symmetricDifference:c2.         
+     self assert:(c1 symmetricDifference:c2) asSet = (c2 symmetricDifference:c1) asSet
+    "
+!
+
 union:aCollection
     "return a new set containing all elements of the receiver 
      plus those of the aCollection"
@@ -3591,11 +3608,11 @@
 !Collection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.235 2009-10-26 15:01:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.236 2009-11-03 20:02:27 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.235 2009-10-26 15:01:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.236 2009-11-03 20:02:27 cg Exp $'
 ! !
 
 Collection initialize!