Alan,

why don't you take? :

public int hashCode() {
int h = hash;
if (h == 0) {
-            int off = offset;
- char val[] = value;
- int len = count; - - for (int i = 0; i < len; i++) { - h = 31*h + val[off++]; - } - hash = h;

+ int len = count; + if (len != 0) { + char[] val = value; + int i = offset; + for (len += i; i != len; i++) + h = 31 * h + val[i]; + hash = h; + } } return h;


-Ulf


Am 28.02.2010 13:14, schrieb alan.bate...@sun.com:
Changeset: f7a6eae6e1eb
Author:    alanb
Date:      2010-02-27 19:29 +0000
URL:       http://hg.openjdk.java.net/jdk7/tl/jdk/rev/f7a6eae6e1eb

6921374: java.lang.String::hashCode() should check for count == 0 to avoid 
repeated stores hash = 0
Reviewed-by: darcy, ohair

! src/share/classes/java/lang/String.java



Reply via email to