Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.309.mcz==================== Summary ====================
Name: Collections-ul.309
Author: ul
Time: 19 February 2010, 3:44:50.455 pm
UUID: 28c775af-d787-1447-aaaa-9fc1b115b8c3
Ancestors: Collections-ul.308
- add missing #like: and #like:ifAbsent:
=============== Diff against Collections-ul.308 ===============
Item was added:
+ ----- Method: WeakSet>>like:ifAbsent: (in category 'accessing') -----
+ like: anObject ifAbsent: aBlock
+ "Answer an object in the receiver that is equal to anObject,
+ or evaluate the block if not found. Relies heavily on hash properties"
+
+ | element |
+ ((element := array at: (self scanFor: anObject)) == flag or: [ element == nil ])
+ ifTrue: [ ^aBlock value ]
+ ifFalse: [ ^element enclosedSetElement ]!
Item was added:
+ ----- Method: KeyedSet>>like:ifAbsent: (in category 'accessing') -----
+ like: anObject ifAbsent: aBlock
+ "Answer an object in the receiver that is equal to anObject,
+ or evaluate the block if not found. Relies heavily on hash properties"
+
+ ^(array at: (self scanFor: (keyBlock value: anObject)))
+ ifNil: [ aBlock value ]
+ ifNotNil: [ :element | element enclosedSetElement ]!
Item was changed:
----- Method: Set>>like:ifAbsent: (in category 'accessing') -----
like: anObject ifAbsent: aBlock
"Answer an object in the receiver that is equal to anObject,
or evaluate the block if not found. Relies heavily on hash properties"
+
+ ^(array at: (self scanFor: anObject))
+ ifNil: [ aBlock value ]
+ ifNotNil: [ :element | element enclosedSetElement ]!
- | element |
- element := array at: (self scanFor: anObject).
- ^ element ifNil: [ aBlock value ] ifNotNil: [ element enclosedSetElement ]!
Item was added:
+ ----- Method: KeyedSet>>like: (in category 'accessing') -----
+ like: anObject
+ "Answer an object in the receiver that is equal to anObject,
+ nil if no such object is found. Relies heavily on hash properties"
+
+ ^(array at: (self scanFor: (keyBlock value: anObject)))
+ ifNotNil: [ :element | element enclosedSetElement]!