Home > database >  Use java_hashcode PLSQL implementation
Use java_hashcode PLSQL implementation

Time:12-17

Everyone a great god, and hashcode function of Java source code is as follows, want to use Oracle_plsql implementation, this function how to write,


Java_hashcode principle: 31 ^ s [0] * (n - 1) + s [1] 31 ^ * (n - 2) +... + s/n - 1

Public int hashCode () {
Int h=hash;
Int len=count;
If (h==0 & amp; & Len & gt; 0 {
Int off=offset;
Char val []=value;

for (int i=0; I & lt; Len. I++) {
H=31 * h + val [off++];
}
Hash=h;
}
Return h;
}
  • Related