title: Copying keys and values from one map to another map
body: <p>I'm trying to copy the keys and values from one map, map1, into another map, map2. The values in map 1 are stored in a set and map 2 should store map1's values in a list. The keys in each should map the same in both maps. </p>
  
  <p>I could loop through the keys in map1 then add those keys to map 2. And have another inner for loop to add each set's elements to the list in map2 but I'm not sure if this is a right way to go about it, or even correct. </p>
  
  <pre><code>public static &lt;K, V&gt; void changeSetToList (Map&lt;K, Set&lt;V&gt;&gt; map1, Map&lt;K, List&lt;V&gt;&gt; map2) {
  for (Map.entry&lt;K, Set&lt;V&gt;&gt; entry : m1.keys()) 
    for (List&lt;V&gt; l : m1.values()) 
        m2.put(entry.getKey(), l.getValue());
  </code></pre>
  
  <p>}</p>
  
  <p>I haven't compiled or tested it yet though. No access to computer.  </p>