title: Moving content from HashMap A to HashMap B using the data from A's Value to be a new Key
body: <p>Is it possible to populate a Hashmap with the KV - pairs of another Hashmap using the data within the source-map. For example, let's consider we have a map that looks like this:</p>
  
  <pre><code>Map&lt;Position,Place&gt; positionMap = new HashMap&lt;Position,Place&gt;();
  </code></pre>
  
  <p>Now consider the Place class contains both a String <code>category</code> and a <code>Position</code>object. </p>
  
  <p>Is it possible to transfer the place objects from the positionMap into the categoryMap using a loop and using the <code>category</code> String found within the Place-object to act as the key of the new HashMap whose values will be sets of Places? So one set containing all places of category A and one containing the places of category B. </p>
  
  <pre><code>Map&lt;String,Set&lt;Place&gt;&gt; categoryMap = new HashMap&lt;String,Set&lt;Place&gt;&gt;();
  </code></pre>