title: HashMap - using custom data objects
body: <p>Suppose, I have a HashMap:</p>
  
  <pre><code>HashMap&lt;MyKey, Integer&gt; HM = new HashMap&lt;MyKey, Integer&gt;();
  </code></pre>
  
  <p>MyKey corresponds to a data object with two integer elements (and a constructor for passing two integers).</p>
  
  <pre><code>HM.put(new MyKey(1,1234), 1); // this seems to work...
  </code></pre>
  
  <p>but, I cannot seem to use it:</p>
  
  <pre><code>System.out.println(HM.containsKey(new MyKey(1,1234)));
  </code></pre>
  
  <p>I get false.</p>
  
  <p>Can a HashMap have a custom data object for a Key? What am I missing?  Thanks...</p>