Status: New
Owner: ----
Labels: Type-Defect Priority-Medium GLASS-Server Version-GLASS0.231
New issue 241 by
[hidden email]: GsPharo-Core does not implement
Collection>>#groupedBy:
http://code.google.com/p/glassdb/issues/detail?id=241To implement Collection>>#groupedBy: you need the following methods from
Pharo:
Collection>>#groupedBy: aBlock
groupedBy: aBlock
"Answer a dictionary whose keys are the result of evaluating aBlock
for all my elements, and the value for each key is the selection of
my elements that evaluated to that key. Uses species."
| groups |
groups := PluggableDictionary integerDictionary.
self do: [ :each |
(groups at: (aBlock value: each) ifAbsentPut: [ OrderedCollection
new
]) add: each ].
self species ~~ OrderedCollection ifTrue: [
groups associationsDo: [ :association |
association value: (self species withAll: association value) ]].
^ groups
PluggableDictionary class>>#integerDictionary
integerDictionary
^ self new hashBlock: [:integer | integer hash \\ 1064164 * 1009]