title: HashSet equality called with passed object instead of stored item
body: <p>In the following code, the output shows <code>CONTAINS</code> for each object, whereas commenting out the anonymous object's <code>equals()</code> method results in <code>MISSING</code>, which leads me to believe the second equality pass (<code>hashCode()</code> -> <code>equals()</code>) actually calls the equality method of the supplied object instead of the object within the collection being tested.</p>
  
  <pre><code>List&lt;String&gt; strings = Arrays.asList("Hello", "there", "Qix");
  HashSet&lt;String&gt; set = new HashSet&lt;&gt;(strings);
  
  for(final String s : strings)
  {
      boolean contains = set.contains(new Object(){
          @Override
          public int hashCode() {
              return s.hashCode();
          }
  
          @Override
          public boolean equals(Object obj) {
              return true;
          }
      });
  
      System.out.format("%s: %s\n",
              s,
              contains ? "CONTAINS" : "MISSING");
  }
  </code></pre>
  
  <p>Why is this? Is it because the <code>equals()</code> method, by principle, should be symmetric between the two objects?</p>