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

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -