Re: NSDictionary ordering
Re: NSDictionary ordering
- Subject: Re: NSDictionary ordering
- From: Tom Harrington <email@hidden>
- Date: Sun, 21 Sep 2003 14:09:03 -0600
On Sunday, September 21, 2003, at 11:46 AM, Anders Totland wrote:
I know this is a kind of dumb question, but will the allKeys method of
an NSDictionary reliably return the same order if the dictionary is
unchanged?
Is there any kind of logic to their order?
Will the dictionary {A = anObject; B = anoherObject; C =
yetAnotherObject } return the same allKeys in ACocoaApp at seven in the
morning and AnotherCocoaApp at three in the evening?
If the one is loaded from a plist and the other is created
programaticcally?
In practice, probably yes. But since the docs specifically say that
the order's not defined, it'd be extremely unwise to rely on this
behavior.
Is there any kind of ordered dictionary, i.e. where the keys of allKeys
are a set, but also ordered?
Not built in. It probably wouldn't be too hard to roll your own, a
class that used NSDictionary and also maintained ordering info.
--
Tom Harrington
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.