Re: allKeys and allValues
Re: allKeys and allValues
- Subject: Re: allKeys and allValues
- From: "gMail.com" <email@hidden>
- Date: Mon, 04 Oct 2010 23:46:41 +0200
- Thread-topic: allKeys and allValues
Ok, I will not rely on that.
Anyway, I have seen that iTunes uses the same dictionary structure.
The file "iTunes Music Library.xml" contains a dictionary called Tracks.
This dict contains a series of dictionaries with an ID as key. So it's very
easy to get a track's dict asking for e.g.
[tracks objectForKey:@"2604"];
Instead using an array of dicts, in case I have to search for an item by its
ID, I must iterate through the whole array looking for that ID, e.g.
for(id item in items){
NSString *ID = [item objectForKey:@"ID];
if([ID isEqualToString:@"inID"])
return item;
}
--
Leo
> Da: Ken Thomases <email@hidden>
> Data: Mon, 4 Oct 2010 16:31:17 -0500
> A: "gMail.com" <email@hidden>
> Cc: <email@hidden>
> Oggetto: Re: allKeys and allValues
>
> On Oct 4, 2010, at 4:21 PM, gMail.com wrote:
>
>> On the docs I read that for both the NSDictionary's allKeys and allValues,
>> the order of the elements in the array is not defined. Ok.
>> But, are the two arrays aligned each other?
>
> If the docs don't contain that promise, then you can't rely on it.
>
> Regards,
> Ken
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden