[squeak-dev] The Trunk: Collections-eem.958.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Sep 13 05:21:40 UTC 2021


Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.958.mcz

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

Name: Collections-eem.958
Author: eem
Time: 12 September 2021, 10:21:36.638507 pm
UUID: b2a7ddb8-1520-483b-96b1-1bf44bf6ec20
Ancestors: Collections-dtl.957

Faster at:ifPresent:

=============== Diff against Collections-dtl.957 ===============

Item was changed:
  ----- Method: Dictionary>>at:ifPresent: (in category 'accessing') -----
  at: key ifPresent: aBlock
  	"Lookup the given key in the receiver. If it is present, answer the value of evaluating the given block with the value associated with the key. Otherwise, answer nil."
  
+ 	^(array at: (self scanFor: key)) ifNotNil: [:assoc| aBlock value: assoc value]!
- 	| v |
- 	v := self at: key ifAbsent: [^ nil].
- 	^ aBlock value: v
- !

Item was changed:
  ----- Method: KeyedSet>>at:ifPresent: (in category 'accessing') -----
  at: key ifPresent: aBlock
  	"Lookup the given key in the receiver. If it is present, answer the value of evaluating the given block with the value associated with the key. Otherwise, answer nil."
  
+ 	^(array at: (self scanFor: key)) ifNotNil: [:obj| aBlock value: obj enclosedSetElement]!
- 	| v |
- 	v := self at: key ifAbsent: [^ nil].
- 	^ aBlock value: v
- !



More information about the Squeak-dev mailing list