Need reviewer for forward port of 6815768 (File.getXXXSpace) and 6815768 (String.hashCode)

Ulf Zibis Ulf.Zibis at gmx.de
Fri Feb 26 16:10:13 UTC 2010


Am 26.02.2010 16:25, schrieb Ulf Zibis:
> So optimum could be:
>

I have one more ...
Additionally we can save double incrementing of int i and off:

public int hashCode() {
   int h = hash;
   if (h == 0) {
     int len = count;
     if (len>  0) {
       char[] val = value;
//      for (int i = offset, len += i; i<  len; ) // would be nice syntax ->  RFE to project coin
       for (int i = offset, limit = len += i; i<  len; i++)
         h = 31*h + val[i];
       hash = h;
     }
   }
   return h;
}


- Ulf






More information about the core-libs-dev mailing list