Jon Sigman wrote:
The underlying issue I was having was how to know when different
objects used as
keys might be reasonably expected to match, especially if they
weren't generated
the same way (as with [NSNumber stringValue] and [NSString ...]).
That's easy: they match when isEqual: returns true.
See the NSDictionary class reference:
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/
Foundation/Classes/NSDictionary_Class/Reference/Reference.html
Find isEqual on the page:
"... no two keys in a single dictionary are equal (as determined
by isEqual:)."
This subtly suggests that key equality is synonymous with isEqual:.
There is also a logical relationship between hash and isEqual, which
must be maintained. Objects that are equal must also have equal
hashes. Or: equality presupposes hash-identicality.
-- GG
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com