我想知道有没有人能够详细解释以下哈希码实现中的代码:
(int)(l ^ (l >>> 32));
这段代码在以下哈希码实现中起到了什么作用(由Eclipse生成,但与Effective Java相同):
private int i;
private char c;
private boolean b;
private short s;
private long l;
private double d;
private float f;
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + i;
result = prime * result + s;
result = prime * result + (b ? 1231 : 1237);
result = prime * result + c;
long t = Double.doubleToLongBits(d);
result = prime * result + (int) (t ^ (t >>> 32));
result = prime * result + Float.floatToIntBits(f);
result = prime * result + (int) (l ^ (l >>> 32));
return result;
}
谢谢!