Thread View: comp.sys.next.programmer
1 messages
1 total messages
Started by Paul Burchard
Fri, 30 Oct 1992 07:24
equality and hashing of objects
Author: Paul Burchard
Date: Fri, 30 Oct 1992 07:24
Date: Fri, 30 Oct 1992 07:24
21 lines
1436 bytes
1436 bytes
I've created a class which redefines the -isEqual: method. I'd like to be able to put such objects into HashTables. The documentation seems to make this logically impossible. HashTable says: If two keys are equal in the sense of isEqual:, then their hashed values must be equal. But Object says: - (unsigned int)hash [...] The integer is guaranteed to always be the same for the same id. Hmmm....so if my -isEqual: comparison depends only on the contents of objects, not their id's, then the only -hash method allowed is one that returns a constant value! That's a pretty rough restriction for a hash function... Can anyone clear up this contradiction? -- -------------------------------------------------------------------- Paul Burchard <burchard@geom.umn.edu> ``I'm still learning how to count backwards from infinity...'' --------------------------------------------------------------------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads