On 30 Nov 2009, at 21:21, Ken Thomases wrote:
> On Nov 30, 2009, at 2:45 PM, Dennis Munsie wrote:
>
>> I run into this all the time where I need to iterate through an
>> NSMutableArray (or set, etc, etc) and remove some of the items. My normal
>> pattern has been this:
>>
>> NSMutableSet *remo
On Nov 30, 2009, at 1:37 PM, Sherm Pendley wrote:
> A safe way to do that is to iterate backwards, starting at the max
> index and counting down to 0. That way, removing the item at the
> current index will only change the indexes of the items you've already
+1. I often use this idiom. You can d
On Mon, Nov 30, 2009 at 4:21 PM, Ken Thomases wrote:
> On Nov 30, 2009, at 2:45 PM, Dennis Munsie wrote:
>
> Some alternatives:
>
> * Iterate over the array just using an index, rather than fast enumeration
> (or NSEnumerator).
A safe way to do that is to iterate backwards, starting at the max
i
On Nov 30, 2009, at 2:45 PM, Dennis Munsie wrote:
> I run into this all the time where I need to iterate through an
> NSMutableArray (or set, etc, etc) and remove some of the items. My normal
> pattern has been this:
>
> NSMutableSet *removeSet = [[NSMutableSet alloc] init];
> for(NSObject *foo