logo       

Re: Re: Recap: How to empty a collection: msg#00138

lang.smalltalk.squeak.beginners

Subject: Re: Re: Recap: How to empty a collection

On Feb 20, 2008, at 2:01 , nicolas cellier wrote:
One thing I wasn't clear on is whether Bert's suggestion:
aColl removeAllSuchThat: [:anElement| true].
Is okay, and why it's okay while many of the other similar approaches were not.


Bert's suggestion is simple and works well.
The only question is about efficiency.
Up to (Down to?) subclasses to optimize it.

#removeAllSuchThat: is actually optimized in subclasses (look at its implementation in OrderedCollection).

- Bert -


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise