/** * simplified version of how String.hashCode works. * For the actual version see src.jar java/lang/String.java * @return a hash code value for this String. */ public int hashCode() { // inside the String is a char[] val that holds the characters. int hash = 0; int len = char.length(); for ( int i=0; i<len; i++ ) { hash = 31 * hash + val[ i ]; } return hash; }