title: Java: How to merge the keys of two maps?
body: <p>I am working in Java, and have declared two maps as follow:</p>
  
  <pre><code>private Map&lt;MyCustomClass, Integer&gt; map1, map2;
  map1 = new HashMap&lt;MyCustomClass, Integer&gt;();
  map2 = new HashMap&lt;MyCustomClass, Integer&gt;();
  
  //adding some key value pair into map1
  //adding some key value pair into map2
  
  private ArrayList&lt;MyCustomClass&gt; list = new ArrayList&lt;MyCustomClass&gt;(); 
  </code></pre>
  
  <p>Now i want to insert the keys of both map in the above declared <code>ArrayList</code>. Is there any built-in method exist for this or i need to writes some custom code?</p>