Is there a use for hashCode() of a mutable object?
<p>I have been going through sources of Java Collections framework and noticed that <code>AbstractList</code> and <code>AbstractMap</code> return the sum of their elements' hash codes as their own hash code value. This makes List and Map implementstions return distinct hash code values depending on the contents of the collection.</p>

<p>The only use for the <code>hashCode()</code> method I know is even distribution of elements into buckets inside data structures that use hashing e.g. <code>HashSet</code> and <code>HashMap</code>. However, the <code>Set</code> and <code>Map</code> contracts specify:</p>

<blockquote>
  <p>The behavior of a set is not specified if the value of an object is changed in a manner that affects equals comparisons while the object is an element in the set.</p>
</blockquote>

<p>and:</p>

<blockquote>
  <p>The behavior of a map is not specified if the value of an object is changed in a manner that affects equals comparisons while the object is a key in the map.</p>
</blockquote>

<p>These contracts make objects that may return distinct hash values depending on their state dangerous to use in sets and as keys in maps. That makes me wonder:</p>

<ol>
<li>Is there a point in returning a variable hash value?</li>
<li>Would not it be better to return a constant (per object class) hash value?</li>
<li>What use can the <code>hashCode()</code> method have besides being used in hash collections?</li>
</ol>