Re: LookupTable vs Dictionary
Posted by Warren Stanley on Feb 13, 2005; 10:44pm
URL: https://forum.world.st/LookupTable-vs-Dictionary-tp3373025p3373047.html
Fernando,
A Dictionary is just a collection of Associations.
A LookupTable has a collection of keys and a collection of values.
From this, the first difference is that a LookupTable can not have nil
a key value, a Dictionary can. This is because an empty key value in a
LookupTables key array is nil, so you can't tell the difference between
an unused slot and one keyed by nil. You should get an error if you try
LookupTable new at: nil put: 1.
The next major difference is in copying. A copy of a dictionary will
share the associations, so changing the value (via #at:put: or directly
manipulating the association) will affect the original and the copy. A
LookupTable does not have any associations so the copy is more like you
would expect.
Otherwise, I am not aware of any major differences between the two.
This should apply for all Smalltalks, but if it doesn't, this is how it
is in VAST.
Warren.
Fernando wrote:
> Hi,
>
> I don't understand very well the difference between both and when
> should either be used preferently. Can anybody help?
> Thanks!
>
--
Warren Stanley
Technical Consultant
R&D team
Application Solutions
Wizard Information Services
To send e-mail, use my name with a dot in the middle,
and the domain is wizardis dot com dot au