What’s the deal with Java equals() and hashcode()?
Continue Reading January 26th, 2010 Jeff Howell
I came across this issue a couple years ago. It was surprisingly not-so-obvious to the developer, a good developer, who was sorting out a very elusive bug in a large Java application.
The symptom was that a Map of objects sometimes returned null when queried. The developer ran the code in a debugger and could see that the object was put into the Map. Yet, when the map was asked to retrieve the object, it was not found (even though it could be seen by inspection in the debugger).
Other objects were successfully stored and retrieved from the same Map.