Re: NSDictionary allKeys and allValues clarification?
Re: NSDictionary allKeys and allValues clarification?
- Subject: Re: NSDictionary allKeys and allValues clarification?
- From: Robert Walker <email@hidden>
- Date: Thu, 5 Jan 2006 08:40:06 -0500
I haven't actually tested this, but I'm pretty sure that the two
arrays will be ordered the same. The keys and values are in an
undefined ordering, but value at index 0 should be the value for the
key at index 0.
However, it's probably safer to iterate over the keys and pull the
values out using objectForkey:
Should be fairly easy for you to test this to verify.
On Jan 5, 2006, at 8:28 AM, Matt Gough wrote:
OK, so the documentation for allKeys and allValues both state:
'The order of the elements in the array isn’t defined'.
Does that really mean that if i do:
NSArray* keys = [dict allKeys];
NSArray* values = [dict allValues];
that there is no guarantee that the items in the two arrays are in
sync with each other.
Should I really be doing:
NSArray* keys = [dict allKeys];
NSArray* values = [dict objectsForKeys:keys notFoundMarker:[NSNull
null]];
Thanks
Matt Gough
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden