title: HashMap way of doing containsKey not behaving as expected
body: <p>Today I was doing some pathfinding when I had to use <code>contains()</code> to find if a class <code>Coord</code> was in an other <code>keySet()</code> of <code>Coord</code>.
  I found that when I used to premade method <code>containsKey()</code>, it was simply not working as I wanted. I made a test to find out what is happening and here it is:</p>
  
  <pre><code>HashMap&lt;Coord, Coord&gt; test = new HashMap&lt;Coord, Coord&gt;();
  test.put(new Coord(3, 3), new Coord(0, 0));
  
  System.out.println("HashMap test for containsKey : " + test.containsKey(new Coord(3, 3)));
  
  boolean containsKey = false;
  for(Coord a : test.keySet())
  {
      if(a.equals(new Coord(3, 3)))
      {
          containsKey = true;
      }
  }
  
  System.out.println("My test for containsKey : "+containsKey);
  </code></pre>
  
  <p>And surprisingly, here is what I found : </p>
  
  <pre><code>HashMap test for containsKey : false
  My test for containsKey : true
  </code></pre>
  
  <p>I just wanted to know what is happening and why.</p>
  
  <p>Also, here is the <code>Coord</code> class :</p>
  
  <pre><code>public class Coord
  {
      public float x, y;
  
      public Coord(float a, float b)
      {
          this.x = a;
          this.y = b;
      }
  
      @Override
      public boolean equals(Object b)
      {
          if(b instanceof Coord)
          {
              Coord casted = (Coord) b;
              return casted.x == x &amp;&amp; casted.y == y;
          }
          return false;
      }
  }
  </code></pre>