IdentitySet.st
changeset 15805 799bc1a4f3af
parent 15037 893c7b5f5776
child 16240 aa502d6cbe9e
child 18107 d46c13a0795b
--- a/IdentitySet.st	Tue Nov 12 19:09:57 2013 +0100
+++ b/IdentitySet.st	Tue Nov 12 19:10:56 2013 +0100
@@ -62,8 +62,14 @@
 
 !IdentitySet methodsFor:'adding & removing'!
 
-removeIdentical:anObject ifAbsent:exceptionBlock
-    ^ super remove:anObject ifAbsent:exceptionBlock
+removeIdentical:oldObject ifAbsent:exceptionBlock
+    "remove oldObject from the collection and return it.
+     If it was not in the collection return the value of exceptionBlock.
+     Uses identity compare (==) to search for an occurrence.
+
+     WARNING: do not remove elements while iterating over the receiver."
+
+    ^ self remove:oldObject ifAbsent:exceptionBlock
 ! !
 
 !IdentitySet methodsFor:'converting'!
@@ -160,6 +166,12 @@
     ]
 !
 
+findIdentical:key ifAbsent:aBlock
+    "IdentitySet does identity compare anyway..."
+
+    ^ self find:key ifAbsent:aBlock
+!
+
 findKeyOrNil:key
     "Look for the key in the receiver.  
      If it is found, return return the index of the first unused slot. 
@@ -271,6 +283,6 @@
 !IdentitySet class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/IdentitySet.st,v 1.36 2013-04-03 09:11:25 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/IdentitySet.st,v 1.37 2013-11-12 18:10:56 stefan Exp $'
 ! !