java - Get same unique id for same string -


is there way find same integer/long or digit number equivalent given string using java.

e.g if give string "java_programming" should give me "7287272" digit.

the generated digit/number should unique i.e. should generate "123" "xyz" not "123" "abc".

call hashcode method of string object.

i.e :

string t = "java_programming"; string t2 = "java_programming"; system.out.println(t.hashcode()); system.out.println(t2.hashcode()); 

gives :

748582308
748582308

using hashcode in case meet requirements (as formuled it) careful, 2 different string can produce same hashcode value ! (see @dirk example)


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -