String hashcode algorithm

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324979704&siteId=291194637