Given a text string like “apple”, I want to obtain a number. So every time I do that with apple I get the same number. How can this be done in java?
Thank you.
EDIT: well, I think I didn’t explain myself well. I mean an existing Java function that implements a map like this. An example of a function like this would be:
a->1, b->2, c->3,…
apple -> 11616125
The answer would be to use the hashCode method of String.