Re: Sorting an NSDictionary?
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 -----