Hello, I wrote a method for NSArray.
- (NSArray *)objectsForKey:(id)key { NSMutableArray *objectsArray = [NSMutableArray arrayWithCapacity:10]; for( id item in self ) { [objectsArray addObject:[item objectForKey:key]]; } return [[objectsArray copy] autorelease]; } What I'm curious is if it is OK to use fast enumeration to implement an NSArray method itself. Because the mechanism for fast enumeration is already there, I basically think it will be OK. However, wouldn't it better to rely on the most fundamental mechanism like objectAtIndex:? I found someone's implementation here at http://svn.opengroupware.org/SOGo/inverse/trunk/SoObjects/SOGo/NSArray+Utilities.m Approaching such a way looks reasonable to me, because it should work whatever underlying mechanism is supported by Objective-C. Will there be any good/bad aspect in using fast enumeration in this case? Thank you. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com