I've heard that it is a bad idea to do something like this. But I am sure there is some rule of thumb which can help to get that right.

When I iterate over an NSMutableDictionary or NSMutableArray often I need to get rid of entries. Typical case: You iterate over it, and compare the entry against something. Sometimes the result is "don't need anymore" and you have to remove it. But doing so affects the index of all the rows, doesn't it?

So how could I safely iterate over it without accidently exceeding bounds or jumping over an element that hasn't been checked?