I have an list of different Strings and I’d need to create a long value for each value trying to ensure that the same String is always mapped into the same long (and if possible no two different String are not transformed to the same long)
How can I do that? Thanks
A starting point could be to use the already-existing
hashCode()function of theStringclass. This returns anintbut should be relatively safe from collisions for dissimilar or sufficiently short inputs. If you need more collision-proofing, consider using a different hashing function.