[squeak-dev] DictionaryIntegrityTest >> #testDictionaries failure
Bert Freudenberg
bert at freudenbergs.de
Tue May 14 23:57:58 UTC 2013
On 2013-05-15, at 00:03, Chris Muller <ma.chris.m at gmail.com> wrote:
>> | a |
>> a := dictionary associationAt: x.
>> a value: a value + 1
>>
>> instead of:
>>
>> | v |
>> v := dictionary at: x.
>> dictionary at: x put: v + 1.
>
> Oh, nice.. Now I feel like I need to go through my code and see if
> I'm doing it the double-lookup way.. :) Thanks.
How about this?
dictionary at: x ifPresentPut: [:v | v + 1].
- Bert -
More information about the Squeak-dev
mailing list
|