[Newbies] How to empty a collection?
Marcin Tustin
mm3 at zepler.net
Tue Feb 19 01:35:34 UTC 2008
Isn't Cedrick's aida solution going to be significantly faster?
On Feb 19, 2008 1:02 AM, Ron Teitelbaum <Ron at usmedrec.com> wrote:
> Hi Sophie,
>
> aCollection copy do: [:anElement |
> aCollection remove: anElement
> ].
>
> Why copy? If you start removing items from the collection, increasing the
> index will cause you to skip elements.
>
> Ron
>
> > -----Original Message-----
> > From: itsme213
> >
> > I want to clear its contents (size goes back to zero), and can't seem to
> > find something like #clear or #empty. Cannot use a new collection as
> there
> > are shared references to it.
> >
> > Thanks - Sophie
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20080219/43fa3343/attachment-0001.htm
More information about the Beginners
mailing list