help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Dictionary and Association


From: Wolfgang Dann
Subject: Re: [Help-smalltalk] Dictionary and Association
Date: Wed, 06 Apr 2011 15:25:18 +0200

Am Mittwoch, den 06.04.2011, 15:07 +0200 schrieb Gwenael Casaccio:
> Hi,
> 
> you can simply do:
> 
> dict := Dictionary new.
> dict at: #key1 put: 'value1'.
> dict at: #key2 put: 'value2'.
> 
> In your case the problem is the assoc variable (you just change the 
> content) here is the solution:
> 
> dict := Dictionary new.
> assoc := Association key: #key1 value: 'value1'. " or #key1->'value1' "
> dict add: assoc.
> assoc := Association key: #key2 value: 'value2'. " or #key2->'value2' "
> dict add: assoc.
> 

I wanted to subclass Association to store a Bookmark.
If i understand you right, then i have to
always send new when the key changes.

thank you in advance


> >
> > _______________________________________________
> > help-smalltalk mailing list
> > address@hidden
> > http://lists.gnu.org/mailman/listinfo/help-smalltalk
> 
> 
> _______________________________________________
> help-smalltalk mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-smalltalk





reply via email to

[Prev in Thread] Current Thread [Next in Thread]