hashCode源码

Posted HelloWorld

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hashCode源码相关的知识,希望对你有一定的参考价值。

private int hash; // Default to 0
public int hashCode() {
        int h = hash;
        if (h == 0 && value.length > 0) {
            char val[] = value;
            for (int i = 0; i < value.length; i++) {
                h = 31 * h + val[i];
            }
            hash = h;
        }
        return h;
}

 

以上是关于hashCode源码的主要内容,如果未能解决你的问题,请参考以下文章