Theocacao
Leopard
Design Element
Comment on "Using NSIndexSet with NSArray"
by kk — Mar 23
Yeah, NSIndexSet is one of the duller knives in the Foundation drawer. Who spec'd _that_ gomer? Obviously someone who forgot the dictum about keeping simple things... simple.

I like your solution, although I would like to see an actual IndexEnumerator class.

I do suggest that if your method declares an NSArray as its return value, that you ought to actually return one. Apple's advice on return types is that you should assume that they are correct, even though they might not be. (?!?)

I feel that it is worth the miniscule cost to rigorously honor the declaration -- it minimizes the odds of a subtle bug down the road.

So,my only adjustment will be to change the return to:

return [[targetArray copy] autorelease];
Back to "Using NSIndexSet with NSArray"
Design Element

Copyright © Scott Stevenson 2004-2015