重写hashCode() 问题,结果为什么是0而不是17?

public class LabelValue {
private String label;
private String value;

public LabelValue(final String label, final String value) {
    this.label = label;
    this.value = value;
}

public String getLabel() {
    return this.label;
}

public void setLabel(String label) {
    this.label = label;
}

public String getValue() {
    return this.value;
}

public void setValue(String value) {
    this.value = value;
}

public int hashCode() {
    return (this.getValue() == null) ? 17 : this.getValue().hashCode();
}

public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof LabelValue)) {
        return false;
    }
    LabelValue bean = (LabelValue) obj;
    int nil = (this.getValue() == null) ? 1 : 0;
    nil += (bean.getValue() == null) ? 1 : 0;
    if (nil == 2) {
        return true;
    } else if (nil == 1) {
        return false;
    } else {
        return this.getValue().equals(bean.getValue());
    }

}

}

public class MyResult {
public static void main(String[] args) {
LabelValue lv1 = new LabelValue("1","router");
LabelValue lv2 = new LabelValue("2","switch");
LabelValue lv3 = new LabelValue("3","router");
LabelValue lv4 = new LabelValue("4","");
System.out.println(lv4.hashCode());
}

}

[code="java"]""[/code]
是空字符串, "" != null , 所以, 得到的是 "".hashCode(),

String.hashCode()算法如下, 可以去看String.hashCode()方法的注释,
[code="java"]
s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
[/code]

于是得到0