[squeak-dev] The Trunk: Collections-nice.928.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Mar 3 14:29:08 UTC 2021


Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.928.mcz

==================== Summary ====================

Name: Collections-nice.928
Author: nice
Time: 3 March 2021, 3:29:05.70662 pm
UUID: ef9658c8-ef7e-a943-8ffc-de7546b29f2f
Ancestors: Collections-nice.927, Collections-nice.634

Merge Collections-nice.634 (Implement replace: in Dictionary)

=============== Diff against Collections-nice.927 ===============

Item was added:
+ ----- Method: Dictionary>>replace: (in category 'enumerating') -----
+ replace: aBlock
+ 	"Destructively replace the values in this Dictionary by applying aBlock, keeping the same keys.
+ 	Implementation note: subclasses not storing the key-value pairs as a list of Associations shall refine this method."
+ 	tally = 0 ifTrue: [ ^self].
+ 	1 to: array size do: [ :index |
+ 		(array at: index) ifNotNil: [ :element |
+ 			element value: (aBlock value: element value) ] ]!

Item was added:
+ ----- Method: OrderedDictionary>>replace: (in category 'enumerating') -----
+ replace: aBlock
+ 	"Like super, but iterate in order."
+ 
+ 	order from: 1 to: tally do: [:each | each value: (aBlock value: each value)]!

Item was added:
+ ----- Method: WeakKeyDictionary>>replace: (in category 'enumerating') -----
+ replace: aBlock
+ 	"Like super except that aBlock shouldn't be invoked for any reclaimed (nil) key."
+ 
+ 	tally = 0 ifTrue: [ ^self].
+ 	1 to: array size do: [ :index |
+ 		(array at: index) ifNotNil: [ :association |
+ 			association key ifNotNil: [ :key | "Don't let the key go away."
+ 				association value: (aBlock value: association value) ] ] ]!



More information about the Squeak-dev mailing list