posted 19 years ago
Yes, the primary benefit of hashCode is fast lookup.
Imagine a library with numerous rows of bookshelves. If you're looking for a particular book, it would be a lot faster if you knew what particular row of shelves to look in, rather than searching through the entire library. Of course, when you've found the correct shelves (indicated by hashCode), there might be other books on those shelves (because different objects might return the same hashCode), but you've narrowed your search to a much smaller region.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org