[Newbies] How to empty a collection?
brian at murphydye.com
Tue Feb 19 02:24:51 UTC 2008
My understanding as well is that this is the purpose of #become:, but
also that it is not very efficient in some versions of Smalltalk. If
you are using an OrderedCollection, this is probably a reasonably
efficient method as it doesn't need to search through the whole list
every time it removes an element:
[self notEmpty] whileTrue: [self removeLast]
On Feb 18, 2008 6:42 PM, Marcin Tustin <mm3 at zepler.net> wrote:
> My own testing suggests that references to the object remain in place. I
> would guess that that is the whole point of become.
> On Feb 19, 2008 1:38 AM, cdrick <cdrick65 at gmail.com> wrote:
> > > Isn't Cedrick's aida solution going to be significantly faster?
> > >
> > this is not mine :)
> > butI'd interested to see if it's a good use of #become:... Does it
> > keep references ? is it safe ?
> > Thanks
> > _______________________________________________
> > Beginners mailing list
> > Beginners at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/mailman/listinfo/beginners
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
More information about the Beginners