I have a tuple class:
I want to override the hashCode method such that it gives a distinct value. However, if num1/num2 are interchanged it should return the same value for the hash code.
example if, if the hash code is n, then when and , the hash code should be n.
if and then hash code should be m where n!=m
I don't have the brains to find an algorithm to implement this If anybody can give me an algorithm, I would appreciate it.
PS. this is not a student assignment or anything. I was asked this in a job interview question and I still don't have the answer, that is why I am posting it.