• 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: Sorting an NSDictionary?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sorting an NSDictionary?


  • Subject: Re: Sorting an NSDictionary?
  • From: "Erik M. Buck" <email@hidden>
  • Date: Mon, 14 Jan 2002 22:12:48 -0600
  • Organization: EMB & Assocites Inc.

As the NSDictionary and NSMapTable and other documentation will tell you,
all objects stored must implement the informal protocol that includes the
methods -compare: and -hash. Since NSObject already implements these
methods, you are in good shape unless you want to customize the behavior.
If you do implement -compare: or -hash, remember that any two objects that
have the same hash must also compare as equal or bad things will happen.

Another UNDOCUMENTED as far as I know issue is that dictionary keys are
COPIED and therefore objects used as keys must conform to the NSCopying
(sp?) protocol.

You may also want NSMutableArray's sorting facilities...


----- Original Message -----

References: 
 >Sorting an NSDictionary? (From: Jeff Galyan <email@hidden>)

  • Prev by Date: Re: NSWorkspaceDidTerminateApplicationNotification bug?
  • Next by Date: Sub-pixel text placement
  • Previous by thread: Sorting an NSDictionary?
  • Next by thread: Re: Sorting an NSDictionary?
  • Index(es):
    • Date
    • Thread