Re: When do I need to override hash?
Re: When do I need to override hash?
- Subject: Re: When do I need to override hash?
- From: Shawn Erickson <email@hidden>
- Date: Thu, 20 Aug 2009 13:35:31 -0700
On Thu, Aug 20, 2009 at 1:30 PM, Bryan Henry <email@hidden> wrote:
>
> Why do you say that? I haven't noticed any documented requirement that ties the implementation details of -hash and -isEqual together.
It is fundamental requirement for the collection classes, etc.
"If two objects are equal, they must have the same hash value. This
last point is particularly important if you define isEqual: in a
subclass and intend to put instances of that subclass into a
collection. Make sure you also define hash in your subclass."
<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html#//apple_ref/occ/intfm/NSObject/isEqual:>
-Shawn
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden