title: How to get a correct array hashcode in scala?
body: <p>What is the suitable way to compute hashCode of an Array that depends on its content?</p>
  
  <p><code>Array.hashCode</code> is for the array instance:</p>
  
  <pre><code>val h = a.hashCode
  println(h == Array(1,2).hashCode) // false
  
  a(0) = 42
  println(h == a.hashCode) // true
  </code></pre>
  
  <p>Note: It'd be better to avoid copying the whole array, to a List for example, prior to computing the hashCode</p>
  
  <p>Why I ask: I use an Array in a class (as a private field) because lookup time is critical, and its content is relevant to compute the hashCode of the class</p>