Um... Thanks for your reply.

The last time I used that was about 5 or 6 years ago, and I wondered yesterday 
where it went away. :)
Thanks for pointing out that method.

BTW, my actual question was if it is meant to use fast enumeration in a 
collection class implementation.
Although I tried to add objectsForKey: to existing NSArray, it should be OK, 
because it is to rely on existing, fully functional one.
However, let's say we write a class like NSArray that supports fast 
enumeration, block based enumeration, numerator based enumeration and finally 
index based iteration.
The rationale behind "enumerator" pattern is to unify the way to access 
collection classes no matter what they actually look like.
So, enumerator pattern is actually written in index based iteration wrapped 
with enumerator pattern.
Similarly, I guessed fast enumeration was based on either index iteration or 
enumerator pattern.
Also, fast enumeration is a language feature. So, if Objective-C without fast 
enumerator is used, methods written with fast enumerator would not work.

So, my question was originally for that. :)
Anyway, it's not big deal now.

Thank you :)
JongAm Park

On Jun 30, 2011, at 12:02 PM, Dave DeLong wrote:

> Yeah, that should be fine, but it's unnecessary.
> 
> You can just do:
> 
> NSArray *objectsArray = [theArray valueForKey:key];
> 
> And it'll do pretty much the same thing (except that it'll call -valueForKey: 
> on each item in the array, and not objectForKey:.  However, if the objects 
> are NSDictionaries, that's pretty much the same thing).
> 
> Dave

_______________________________________________

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

Reply via email to