java中String类的hashCode方法实现

来源:互联网 发布:mac升级macos sierra 编辑:程序博客网 时间:2024/04/19 05:06
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;    }

0 0
原创粉丝点击