Here is what is advertised in the Java API to be the implementation of hashCode() in the String class:
public int hashCode() { int result = 0; for(int i = 0; i < this.length(); i++) { result = 31 * result + (int) this.charAt(i); } return result; }
Here is what is advertised in the Java API to be the implementation of hashCode() in the String class:
public int hashCode() { int result = 0; for(int i = 0; i < this.length(); i++) { result = 31 * result + (int) this.charAt(i); } return result; }