• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDictionary ordering
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Font Collections
      • From: Seth Willits <email@hidden>
References: 
 >NSDictionary ordering (From: Anders Totland <email@hidden>)

  • Prev by Date: Re: Using a String Object in another class
  • Next by Date: Re: Using a String Object in another class
  • Previous by thread: NSDictionary ordering
  • Next by thread: Font Collections
  • Index(es):
    • Date
    • Thread