Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Range of hashcodes in case of strings

I have strings coming in my code and i take hashcode of them for some purpose but i was wondering that is there any range of these hashcodes because this may happen that the number of strings coming exceed the range of hashcodes.So what is the range of hashcodes?

like image 260
Xara Avatar asked Sep 05 '25 03:09

Xara


1 Answers

The range of hashCode is the range of int. For any desired hashCode(), there is a String with that hashCode.

like image 79
Louis Wasserman Avatar answered Sep 07 '25 21:09

Louis Wasserman