[squeak-dev] The Inbox: Collections-pre.679.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Feb 26 15:05:49 UTC 2016


A new version of Collections was added to project The Inbox:
http://source.squeak.org/inbox/Collections-pre.679.mcz

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

Name: Collections-pre.679
Author: pre
Time: 26 February 2016, 4:04:56.205127 pm
UUID: 2ac5821c-d6f5-418c-ab07-ed3c2b9de62c
Ancestors: Collections-eem.678

This is a new iteration method which allows the iteration over asymmetric pairs. I have found this useful in game collision detections or duplicate detections. Alternatively we might want to take a second collection as input and create asymmetric pairs from self and this second collection.

=============== Diff against Collections-eem.678 ===============

Item was added:
+ ----- Method: Collection>>asymmetricPairsDo: (in category 'accessing') -----
+ asymmetricPairsDo: aBlock
+ 
+ 	| iterationCollection currentElement |
+ 	iterationCollection := self copy.
+ 	
+ 	[currentElement := iterationCollection anyOne.
+ 	iterationCollection remove: currentElement.
+ 	iterationCollection isEmpty not]
+ 		whileTrue: [ iterationCollection 
+ 			do: [:element | aBlock value: currentElement value: element]].!



More information about the Squeak-dev mailing list