Effective java hashcode implementation
- by Scobal
I was wondering if someone could explain in detail what
(int)(l ^ (l >>> 32));
does in the following hashcode implementation (generated by eclipse, but the same as 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;
}
Thanks!