title: How to use set of elements as key in java maps?
body: <p>I want to store a value based on a key, composed of set of elements. Something like the example below. Of course I know that my pseudo-example wouldn't work, as the hash of the object will probably be it's address which will be unique for each new instance, regardless of it's contents.</p>
  
  <pre><code>    // in this pseudo-example this is my SET http://algs4.cs.princeton.edu/35applications/SET.java.html
      // but the idea is that values are unique
      HashMap&lt;SET&lt;Integer&gt;, String&gt; map = new HashMap&lt;&gt;();
      SET a = new SET();
      a.add(1);
      a.add(2);
      a.add(5);
  
      SET b = new SET();
      b.add(5);
      b.add(1);
      b.add(2);
  
      map.put(a, "w00t");
  
      System.out.println(map.get(b)); // I would want to get "w00t" because my key is the same set of elements
  </code></pre>
  
  <p>Of course I can just sort and concatenate the SET values as a string, with a separator and use that in a <code>HashMap&lt;String, String&gt;</code> structure but that just doesn't feel right. I'm quite new to Java programming so there might be an obvious solution that I'm missing.</p>