public int hashCode() {
final int prime = 31;
int result = 1;
result = prime
* result
+ ((temp1== null) ? 0 : temp1.hashCode());
result = prime
* result
+ ((temp2== null) ? 0 : temp2.hashCode());
return result;
}
I don't really understand about haschodes, yet, so I can't seem to get my head around what exactly is generated by this hascode() method. All I know is, it's an integer :X
Right now, I am thinking the line in question (as is for temp1)..
((temp2== null) ? 0 : temp2.hashCode())
..means if temp2 is null then set to zero, if not set temp2 with the value of temp2.hashcode()? Am I on the right track?
Also, what does this overall hashcode() method do?
Thanks :?: