• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

hashcode

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am very confused with hashcode() can any one explain in the proper way this concept with a example
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Anea
go thru this
web pagelink
Might be it clears your air for hashcode()
 
anita dhar
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks i will go through this link and will be back with my queries
 
Won't you please? Please won't you be my neighbor? - Fred Rogers. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic