[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: remove all from a List
From: |
Roger Burkhart |
Subject: |
Re: remove all from a List |
Date: |
Sun, 4 Feb 96 10:13:39 MST |
> Here is how I check to see if the superiors List exists,
> and if it does, re-start it with no members:
>
> if ( superiors )
> [superiors drop];
> superiors = [List create: xZone];
>
> There may be a way to [superiors deleteAll] or some such,
> but I don't know how to do it, and haven't been
> able to find it in the swarm/support/collections/*.h files.
No, there's not a built-in method to do this yet, but it probably makes
sense to have one, and I'd considered it previously. The method would
be [aCollection removeAll]; which would remove all members but not
dispose of them, as well as perhaps [aCollection deleteAll], which
would both remove each member and drop it.
These methods are equivalent to:
index = [aCollection begin: aZone];
while ( (member = [index next]) ) {
[index remove];
[member drop]; // deleteAll only
}
I'll try to get these into the release we're expecting late this week,
along with other pending changes.
Roger