When should I define an hash code function for my types?
<p>Is there any other reason for implementing an hash code function for my types other than allowing for good use of hash tables? </p>

<p>Let's say I am designing some types that I intend to use internally. I know that types are "internal" to the system, and I also know I will never use those types in hash tables. In spite of this, I decide I will have to redefine the equals() method.</p>

<p>Theory says I should also redefine the hash code method, but I can't see any reason why, in this case, I should do it.</p>

<p>Can anyone point me out any other reason?</p>

<p>This question can be rephrased to : <em>in which situations should we implement a hash code method in our types.</em></p>

<p>PS : I am not asking how to implement one. I am asking <em>when</em>.</p>
