Design Element
Comment on "Using NSIndexSet with NSArray"
by Dan — Oct 26
I guess I'm a little late to the party, but as of 10.4, NSArray has an objectsAtIndexes: method that does just what you describe in this post.

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

return [[targetArray copy] autorelease];

Just out of curiosity, would this approach have any advantages over using:

return [NSArray arrayWithArray:targetArray];

The latter seems to not involve copying the objects in the array, so it might be a little faster.
Back to "Using NSIndexSet with NSArray"
Design Element

Copyright © Scott Stevenson 2004-2015