hg: jdk7/tl/jdk: 2 new changesets

Ulf Zibis Ulf.Zibis at gmx.de
Sun Feb 28 13:25:31 UTC 2010


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.bateman at 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
>
>
>    

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20100228/79d0cf3d/attachment.html>


More information about the core-libs-dev mailing list