Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / April 2005

Tip: Looking for answers? Try searching our database.

how does hashCode work?

Thread view: 
Mike G - 19 Apr 2005 05:51 GMT
Hello all, I was wondering if anyone knows the standard way in which
java implements hashCode?

I want to be able to take two keys and make sure that they are placed
within the same 'bucket' in a hashtable. This is probably bit strange
of an operation, but I need to do it (long story). One key will be set
and an integer, the other can be anything. The size of the hashtable
will be known so that I could create it with a predetermined size.

I figure I could just write my own hashCode and equals, but if possible
I'd rather manipulate the standard way.

Any help would be appreciated.
Thomas Schodt - 19 Apr 2005 06:59 GMT
> Hello all, I was wondering if anyone knows the standard way in which
> java implements hashCode?
[quoted text clipped - 7 lines]
> I figure I could just write my own hashCode and equals, but if possible
> I'd rather manipulate the standard way.

If you peek at the source you'll see that
  Integer.hashCode()
just returns the int it encapsulates.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.