How can i generate a long hash of a String?

后端 未结 4 2019
没有蜡笔的小新
没有蜡笔的小新 2021-01-04 21:27

I have a java applciation in which I want to generate long ids for strings (in order to store those strings in neo4j). In order to avoid data duplication, I wou

4条回答
  •  暖寄归人
    2021-01-04 22:12

    Why don't you have a look a the hashcode() function of String, and just adopt it to using long values instead?

    Btw. if there was a way to create a unique ID for each String, then you would have found a compression algorithm that would be able to pack every String into 8 bytes (not possible by definition).

提交回复
热议问题