--- a/Collection.st Sun Dec 27 19:45:23 2009 +0000
+++ b/Collection.st Sun Dec 27 20:16:54 2009 +0000
@@ -379,19 +379,20 @@
!
groupBy:keyBlock having:selectBlock
- "Like in SQL operation - Split the recievers contents into collections of
+ "Like in SQL operation - Split the receiver's contents into collections of
elements for which keyBlock returns the same results, and return those
collections allowed by selectBlock. "
|result key|
+
result := OrderedDictionary new.
- self do:
- [:e |
- key := keyBlock value: e.
- (result includesKey: key)
- ifFalse: [result at: key put: OrderedCollection new].
- (result at: key)
- add: e].
+ self do:[:e |
+ key := keyBlock value: e.
+ (result includesKey: key) ifFalse: [
+ result at: key put: OrderedCollection new
+ ].
+ (result at: key) add: e
+ ].
^ result := result select: selectBlock
"
@@ -3617,14 +3618,15 @@
!Collection class methodsFor:'documentation'!
version
- ^ '$Id: Collection.st 10480 2009-12-02 21:30:55Z vranyj1 $'
+ ^ '$Id: Collection.st 10489 2009-12-27 20:16:54Z vranyj1 $'
!
version_CVS
- ^ '§Header: /cvs/stx/stx/libbasic/Collection.st,v 1.237 2009/11/03 20:02:57 cg Exp §'
+ ^ '§Header: /cvs/stx/stx/libbasic/Collection.st,v 1.238 2009/12/07 14:50:17 cg Exp §'
! !
Collection initialize!
+