Dave DeLong wrote:
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
On 1 Jul 2011, at 12:59, Gregory Weston wrote:
Dave DeLong wrote:
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
On 30 Jun 2011, at 22:41, Quincey Morris wrote:
On Jun 30, 2011, at 13:51, JongAm Park wrote:
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
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]];
}
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,
You might also try HBCollections, a series of collections categories I wrote
that makes it easy to do stuff like this.
https://github.com/hborders/HBCollections
-Heath
On Jun 30, 2011 2:10 PM, Dave DeLong davedel...@me.com wrote:
___
Cocoa-dev mailing
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
On Jun 30, 2011, at 13:51, JongAm Park wrote:
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
Wow.. great information!
Thank you very much for sharing your idea!
It definitely helped me!
JongAm Park
On Jun 30, 2011, at 2:41 PM, Quincey Morris wrote:
On Jun 30, 2011, at 13:51, JongAm Park wrote:
The rationale behind enumerator pattern is to unify the way to access
collection