Last active
December 15, 2015 21:49
-
-
Save vaskoz/5328607 to your computer and use it in GitHub Desktop.
Compare Java hashing functions between JVM invocations. NOTE: This example will only run on Java 7.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Hash { | |
public static void main(String[] args) { | |
String str = "Java Programming Language"; | |
System.out.println(str + " hashCode(): " | |
+ str.hashCode() | |
+ " new Java 7 hashCode used by collections: " | |
+ sun.misc.Hashing.stringHash32(str)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment