The Artima Developer Community
Sponsored Link

Java Answers Forum
hashcode()

1 reply on 1 page. Most recent reply: Aug 31, 2005 10:55 PM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
avishek gorai

Posts: 1
Nickname: avishek
Registered: Aug, 2005

hashcode() Posted: Aug 30, 2005 5:16 AM
Reply to this message Reply
Advertisement
Can anybody tell me which algorithm is used by hashcode() function of object class and what parameters it takes to determine the hashcode of the object referenced?


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: hashcode() Posted: Aug 31, 2005 10:55 PM
Reply to this message Reply
It doesn't take any parameters.

How the hashcode is computed it dependent on the JVM, probably, but I would guess some JVMs just return the int value of the underlying pointer to the object.

Read this: http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#hashCode()

If what you are really asking is how to compute the hashcode for a class of your own, you should get a copy of the book Effective Java.

Flat View: This topic has 1 reply on 1 page
Topic: Language Translations Previous Topic   Next Topic Topic: Dynamic proxy

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use