[squeak-dev] The Inbox: Collections-mt.932.mcz
Tony Garnock-Jones
tonyg at leastfixedpoint.com
Fri Mar 26 19:26:31 UTC 2021
What about something like:
collection: aClass at: key do: aBlock
| coll result |
coll := self at: key ifAbsentPut: [aClass new].
result := aBlock value: coll.
coll ifEmpty: [self removeKey: key].
^ result
... perhaps with `ensure:` to do the removal?
Then:
myDictOfSets collection: Set at: #key1 do: [:s | s add: 123].
On 3/26/21 8:17 PM, Marcel Taeumel wrote:
> ...
More information about the Squeak-dev
mailing list
|