Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recommended hash function for overwriting NSObject's hash method

What's a good hash function for overwriting NSObject's hash method in your custom classes?

like image 341
cfischer Avatar asked May 06 '11 17:05

cfischer


1 Answers

Here is a good community wiki page discussing overwriting the functions Implementing -hash / -isEqual: / -isEqualTo...: for Objective-C collections.
And there is an implementation on one of the linked articles Best practices for overriding isEqual: and hash.

like image 200
mistagrooves Avatar answered Oct 03 '22 07:10

mistagrooves