Problem with Sets

Adrian Lienhard adi at netstyle.ch
Wed Jul 23 08:14:02 UTC 2003


We had the same problems...

> Hi all,
>
> I recently have two problems with collections :
> - first the method "atRandom:" does not seem to have been implemented for
Bag (maybe a lack) as it is for Set or others.

There has been a thread some weeks ago. See "[BUG][FIX] Set>>atRandom: is
not random"

> - the latter (but not the least), I had a problem in retrieving objects in
Sets. Sometimes , when using method "includes: anObject", it didn't find
several objects though the Set contained them really and the hashcodes were
correct. I first thought in a bug in my program, but only by changing my Set
by an OrderedCollection (just one word in my code) it resolves the problem
(and disturbed me a little).

You're probably modifying your objects after adding them to the set. This
chanches their hash code and so searching gets messed up...

Adrian & Lukas



More information about the Squeak-dev mailing list