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;
}

 

posted @ 2017-06-22 11:59  胡一生  阅读(224)  评论(0)    收藏  举报