Timeline for Best implementation for hashCode method for a collection
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| S Aug 31, 2017 at 13:49 | history | suggested | Attila | CC BY-SA 3.0 | corrected spelling and minor grammar mistakes |
| Aug 31, 2017 at 13:10 | review | Suggested edits | |||
| S Aug 31, 2017 at 13:49 | |||||
| Jun 3, 2016 at 19:04 | comment | added | Darrell Teague | Good comments but be careful about using the term 'different objects' ... because equals() and thus the hashCode() implementation are not necessarily about different objects in an OO context but are usually more about their domain model representations (e.g., two people can be considered the same if they share a country code and country ID - though these may be two different 'objects' in a JVM - they are considered 'equal' and having a given hashCode)... | |
| Sep 15, 2015 at 11:55 | comment | added | Christopher Rucinski | This should just be a comment to the above post to Grey. Good information but it does not really answer the question | |
| Apr 29, 2013 at 8:45 | comment | added | Krzysztof Jabłoński | If (A != B) and (A.hashcode() == B.hashcode()), that's what we call hash function collision. It's because hash function's codomain is always finite, while it's domain is usually not. The bigger the codomain is, the less often the collision should occur. Good hash function's should return different hashes for different objects with greatest possibility achievable given particular codomain size. It can rarely be fully guaranteed though. | |
| Sep 22, 2008 at 8:47 | history | answered | panzupa | CC BY-SA 2.5 |