Thread: .hashCode()
View Single Post
Old 10-14-2002, 01:34 PM   #2 (permalink)
technobard
Centurion Nova Prime
 
technobard's Avatar
 
Join Date: May 2002
Location: Oak Park, IL (USA)
Posts: 287
technobard is on a distinguished road
Hey, abc123.

Hashcode and equals are both used for comparison purposes. If you were to store a collection of objects in a Hashtable (or Hashmap), the hashcode method would be used to calculate the hash values.

They go hand in hand. If objects a1 and a2 are equal, a1.hashcode() == a2.hashcode() must be true.

Beyond that, I don't really know the details.
technobard is offline   Reply With Quote