Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Overall an excellent article, but its worth mentioning that as I understand it, String's hashCode() method pre-1.3 or 1.2 (forgot exactly which version they switched over) used a different function, so it can indeed change (as the hashCode() contract allows)


It could change, but Object.hashCode(), if not overridden, is operating on the most basic type of Object with zero data members. So they pretty much have to go to the memory address for the hashing functionality, since there's no other information to hash off of. Unless they wanted to just "return 0" for every single one which would be pretty dumb.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: