473,503 Members | 2,148 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you compute Hashcode in Java ?

Hi,
Just wondering what's the algo used to compute hashcode in Java ? Does
anybody here know ?

Thanks,
-MK.
Jul 17 '05 #1
1 6795
On 10 Aug 2004 19:29:59 -0700, pentium77 wrote:
Just wondering what's the algo used to compute hashcode in Java ? Does
anybody here know ?


Read the documentation for Object.hashCode().

There is no single algorithm for computing hashcodes, it depends on
what your data consists of. You most likely don't use the same
algorithm to compute the hashcode of an Integer and an EmployeeRecord.

The important details are that the hashcode for an object cannot
change, and that two objects that are equal must have the same
hashcode (that doesn't mean that objects that are not equal must have
different hashcodes, although that is usually desireable).

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3882
by: Nick | last post by:
Hi all, I am using GetHashCode on unique strings to get a unique integer for a string that I can then place into a database (use int rather than the string to make indexing faster). The problem...
3
8478
by: Josema | last post by:
Hi to all, In a lot of type of classes in the .net framework classes library i see that has the method GethashCode. What is the HashCode of anything, and in wich kind of functionality are used...
1
1702
by: Frank | last post by:
Hi, I save the hashcode of a datatablerow. How do I use that hascode to get to the original datarow? Thanks Frank
8
3529
by: MuZZy | last post by:
Hi, Why for god sake they change implementation of String.GetHashCode() from ..NET 1 to .NET 2? We were storing some user passwords in hashcode, now we can't upgrade those clients with .NET 2...
9
2079
by: archana | last post by:
Hi all, I have one question regarding hashing in .net I have two string containing same data. When i see hashcode by calling gethascode, i am getting same value. I want to know how...
14
2000
by: AZRebelCowgirl73 | last post by:
I am new to Java and am currently taking a class where one of our assignments is to compute the mass of an aluminum block. We are currently on week 2 and only into our second chapter. I am...
11
2296
madhoriya22
by: madhoriya22 | last post by:
Hi, I have wrapped to strings in a object using hashCode of these strings.......Now I want to know how can I get back these strings from the object...............I am putting this object as a key...
1
1666
by: praveenkumarvpk | last post by:
public static void main(String args) { String elements = { "A", "B", "C", "D", "E" }; Integer l = {1,2,68}; Integer y=1; int d=0; for(int i=0;i<l.length;i++) ...
0
1723
by: ccarter45 | last post by:
I need to compute the differences in color between 2 pictures. Also, I need to write a method that computes a useful difference color of two colors (where the colors and their difference will be...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7353
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7011
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5596
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4689
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
401
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.