removing all elements from a collection -djb

Derek Brans brans at nerdonawire.com
Sun Apr 20 18:08:32 UTC 2003


I can't seem to find a method for removing all elements from a collection.  I wonder why that is?

Perhaps it's because you're just expected to throw the whole collection out and use Collection new.

But suppose you wanted to keep the collection and just remove each element one by one.  What is the best way to implement that?

Collection>>removeAllElements
self removeAll: self.  "This doesn't work"

Collection>>removeAllElements
self removeAll: self copy  "Seems to work..."

Derek Brans
Nerd on a Wire
Web design that's anything but square
http://www.nerdonawire.com 
phone: 604.874.6463
mailto: brans at nerdonawire.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030420/3e2ed5b0/attachment.htm


More information about the Squeak-dev mailing list