File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes retrieving the value from bucket..!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "retrieving the value from bucket..!!" Watch "retrieving the value from bucket..!!" New topic
Author

retrieving the value from bucket..!!

Saral Saxena
Ranch Hand

Joined: Apr 22, 2011
Posts: 202

How will you retreive if two different objects have same hashcode?


Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Saral Saxena wrote:How will you retreive if two different objects have same hashcode?


It depends on the implementation.

It took me about 5 seconds with google to find this: http://en.wikipedia.org/wiki/Hashtable

Please spend more time and effort researching before posting questions.
Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1509
    
    5

Saral Saxena wrote:How will you retreive if two different objects have same hashcode?



Please TellTheDetails. Retrieve from where? HashMap? Hashtable? HashSet? or anything else?

Also, have you heard about equals method?


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Saral Saxena
Ranch Hand

Joined: Apr 22, 2011
Posts: 202

Anayonkar Shivalkar wrote:
Saral Saxena wrote:How will you retreive if two different objects have same hashcode?



Please TellTheDetails. Retrieve from where? HashMap? Hashtable? HashSet? or anything else?

Also, have you heard about equals method?


from HashMap..!!
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2266
    
    3

Saral, I think it will be useful to you if you understand the hashCode() contract. Also, please take a look at the equals contract.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: retrieving the value from bucket..!!