And by Java12, they stopped saying anything about memory location at all. But people still learn that the hash code represents its memory address, which has never actually been true. Did a teacher tell you that, or did you read it in some book or other?The Java10 API wrote:The hashCode may or may not be implemented as some function of an object's memory address at some point in time.
There are three kinds of actuaries: those who can count, and those who can't.
Often the most important part of the news is what they didn't tell.
Tim Holloway wrote:The default hashCode() value could be any unique value.
Carey Brown wrote:
Tim Holloway wrote:The default hashCode() value could be any unique value.
The value could be unique, but the likely hood is not guaranteed and can even be quite repetitive depending on the hashing algorithm and the data being hashed. As an extreme example, there's nothing preventing an implementation of hashCode() from always returning '1'. In the end there are only so many unique integer values.
Often the most important part of the news is what they didn't tell.
Campbell Ritchie wrote:With the exception of a few types where there is a bijective (one‑to‑one) relationship between the value and its hash code (e.g. Integer), is a perfect hash ever going to be feasible to implement?
Often the most important part of the news is what they didn't tell.
Does that mean no overflows whilst calculating the hash? How do you achieve that? Except for the case of things like Integer which I mentioned earlier.Tim Holloway wrote:. . . a hash with no overflows . . ..
Often the most important part of the news is what they didn't tell.
Don't play dumb with me! But you can try this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
|