[Pkg] The Trunk: Collections-cmm.585.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Oct 21 00:49:17 UTC 2014


Chris Muller uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-cmm.585.mcz

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

Name: Collections-cmm.585
Author: cmm
Time: 20 October 2014, 7:48:42.698 pm
UUID: 954b50eb-27a5-41e8-9b9f-a49f39336c75
Ancestors: Collections-ul.584

Speed up visiting with #addNewElement:.   It provides the common pattern of checking for inclusion, followed by add:, in just one scan, instead of two.

=============== Diff against Collections-ul.584 ===============

Item was added:
+ ----- Method: Set>>addNewElement: (in category 'adding') -----
+ addNewElement: anObject 
+ 	"Ensure anObject is part of the receiver.  Answer whether its membership was newly acquired."
+ 	| index |
+ 	index := self scanFor: anObject.
+ 	^ (array at: index)
+ 		ifNil:
+ 			[ self
+ 				atNewIndex: index
+ 				put: anObject asSetElement.
+ 			true ]
+ 		ifNotNil: [ false ]!



More information about the Packages mailing list