Skip to main content

Timeline for Java hashCode method in VB.NET

Current License: CC BY-SA 3.0

5 events
when toggle format what by license comment
May 28, 2015 at 14:05 comment added Rick B. Thanks that was very helpful. I was unable through my initial search to find the code snippet that you found. You are correct that does solve the problem. I dismissed your answer to soon ;) Thanks! I will post the code to the solution
May 28, 2015 at 13:48 comment added Rick B. Ok I will give it try. Initially looking at the code I am not seeing the potential wrap to a negative value.
May 28, 2015 at 13:47 comment added maaartinus @RickB. I know that you needs exactly the same numbers. But using the Java algorithm is much easier and much faster than using the underlying formula. Test it with a string of a few thousand chars and we'll see. +++ "If you test it using you will see it uses the algorithm" - I pointed you to how it really gets computed in Java, do you think that grepcode lies? +++ And sure, the formula returns the same results.
May 28, 2015 at 13:38 comment added Rick B. First I understand this not ideal, but I must emulate the existing functionality as a requirement (read my comment about turning on arithmetic overflow...).Test It With --> rextester.com/XKJZ76484 If you test it using you will see it uses the algorithm: s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
May 28, 2015 at 13:19 history answered maaartinus CC BY-SA 3.0