title: How to compute a unique 'signature' for a list of numbers?
body: <p>Given a list of numbers, for example some unique integer or long ID's what would be an optimum way to compute a reproducible 'signature' (preferably irregardless of element order)?</p>
  <p>The use case is to detect whether any of the IDs have been added or removed from a list (of objects).</p>
  <p>Java's <code>array.hashCode()</code> does not fit the bill, because even if it is apparently consistent between JVM invocations it returns a different hash if the order of elements changes or if another instance with the same elements is created:</p>
  <pre class="lang-java prettyprint-override"><code>int[] ids1 = {1, 2, 3};
  System.out.println(ids1.hashCode());
  // output: 980546781
  
  int[] ids1Copy = {1, 2, 3};
  System.out.println(ids1Copy.hashCode());
  // output: 2061475679
  
  int[] ids2 = {2, 1, 3};
  System.out.println(ids2.hashCode());
  // output: 140435067
  </code></pre>
  <p>My understanding is that <code>ids1.hashCode()</code> computes the hash for the memory address of the array and <em>not</em> a cumulative hash code for the primitive elements in the array.</p>
  <p>What other approaches could be used in this case apart from hashing each element separately?</p>