IdentitySet.st
branchjv
changeset 18107 d46c13a0795b
parent 18045 c0c600e0d3b3
parent 15805 799bc1a4f3af
child 18120 e3a375d5f6a8
equal deleted inserted replaced
18106:48ba10eeb21c 18107:d46c13a0795b
    60     "
    60     "
    61 ! !
    61 ! !
    62 
    62 
    63 !IdentitySet methodsFor:'adding & removing'!
    63 !IdentitySet methodsFor:'adding & removing'!
    64 
    64 
    65 removeIdentical:anObject ifAbsent:exceptionBlock
    65 removeIdentical:oldObject ifAbsent:exceptionBlock
    66     ^ super remove:anObject ifAbsent:exceptionBlock
    66     "remove oldObject from the collection and return it.
       
    67      If it was not in the collection return the value of exceptionBlock.
       
    68      Uses identity compare (==) to search for an occurrence.
       
    69 
       
    70      WARNING: do not remove elements while iterating over the receiver."
       
    71 
       
    72     ^ self remove:oldObject ifAbsent:exceptionBlock
    67 ! !
    73 ! !
    68 
    74 
    69 !IdentitySet methodsFor:'converting'!
    75 !IdentitySet methodsFor:'converting'!
    70 
    76 
    71 asIdentitySet 
    77 asIdentitySet 
   158             ^ aBlock value
   164             ^ aBlock value
   159         ]
   165         ]
   160     ]
   166     ]
   161 !
   167 !
   162 
   168 
       
   169 findIdentical:key ifAbsent:aBlock
       
   170     "IdentitySet does identity compare anyway..."
       
   171 
       
   172     ^ self find:key ifAbsent:aBlock
       
   173 !
       
   174 
   163 findKeyOrNil:key
   175 findKeyOrNil:key
   164     "Look for the key in the receiver.  
   176     "Look for the key in the receiver.  
   165      If it is found, return return the index of the first unused slot. 
   177      If it is found, return return the index of the first unused slot. 
   166      Grow the receiver, if key was not found, and no unused slots were present"
   178      Grow the receiver, if key was not found, and no unused slots were present"
   167 
   179 
   269 ! !
   281 ! !
   270 
   282 
   271 !IdentitySet class methodsFor:'documentation'!
   283 !IdentitySet class methodsFor:'documentation'!
   272 
   284 
   273 version
   285 version
   274     ^ '$Header: /cvs/stx/stx/libbasic/IdentitySet.st,v 1.36 2013-04-03 09:11:25 stefan Exp $'
   286     ^ '$Header: /cvs/stx/stx/libbasic/IdentitySet.st,v 1.37 2013-11-12 18:10:56 stefan Exp $'
   275 ! !
   287 ! !
   276 
   288