aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes hashcode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "hashcode" Watch "hashcode" New topic
Author

hashcode

anita dhar
Ranch Hand

Joined: Jul 14, 2007
Posts: 69
i am very confused with hashcode() can any one explain in the proper way this concept with a example
Charandeep Singh
Ranch Hand

Joined: May 06, 2007
Posts: 57
Hi Anea

i am very confused with hashcode() can any one explain in the proper way this concept with a example

The main thing to understand related to hashcode is like
if you have 10 objects which are of same type with different weights and you have 10 bags each of different colour
so just to make things easier for yourself what you will do you will place each object in different bag and recognize them with the colour of the bag
same way you use hascode() to have each element a unique identity so that it becomes easier to fetch each object .
That is why we say that the when each element has a unique hashCode() the efficent is the implmentation of that HashMap().

Be more specific in your problem may then may be we are able to provide you better understanding .

All the best
anita dhar
Ranch Hand

Joined: Jul 14, 2007
Posts: 69
thanks , i understood the this , can you tell me in some brief its implementation what is means to override the hshcode() can you give any simple example of this
thanks
Charandeep Singh
Ranch Hand

Joined: May 06, 2007
Posts: 57
Hi Anea
go thru this
web pagelink
Might be it clears your air for hashcode()
anita dhar
Ranch Hand

Joined: Jul 14, 2007
Posts: 69
Thanks i will go through this link and will be back with my queries
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: hashcode