HashCode is a value computed in such way to be unique as possible to improve
performance while retrieving object in HashedCollections.
If for example you have a HashMap, and didn't overrride hashCode() method
all your objects will be in the same bucket resulting a slow execution while
retrieving an object.
But if you do provide an efficient implementation of hashCode() method your
objects will be stored across many buckets and you look up for one of them,
the api does calculate the hashCode of your object and then it selects the
right bucket. After that we go through the bucket to find the needed object.

On Wed, Sep 15, 2010 at 12:35 PM, Pankaj D <pankaj66...@gmail.com> wrote:

> HI if someone can answer this query what is hash code in java ...is it some
> sort of memory location or address ...?
>
> Regards
> Pankaj
>

Reply via email to