transform HashMap
<p>I have a <code>Map&lt;String, Map&lt;String, Double&gt;&gt;</code> variable.<br>
By way of example:</p>

<pre><code>{user0, {Item1, 2.5, Item2, 3.5}}  
{user1, {Item1, 3.0, Item2, 2.0}}
</code></pre>

<p>I want to take the following output:</p>

<pre><code>{Item1, {user0, 2.5, user1, 3.0}}  
{Item2, {user0, 3.5, user2, 2.0}}
</code></pre>

<p>I wrote the following code to do that:</p>

<pre><code>for(Map.Entry&lt;String, Map&lt;String, Double&gt;&gt; entry : usersMap.entrySet()){
    for(Map.Entry&lt;String, Double&gt; ent : entry.getValue().entrySet()){
        people.put(entry.getKey(), ent.getValue());
        transform.put(ent.getKey(), people);
    }
}
</code></pre>

<p>but I take the following:</p>

<pre><code>{Item1, {user0, 3.0, user1, 2.0}}  
{Item2, {user0, 3.0, user2, 2.0}}
</code></pre>

<p>Can you give me some help here?</p>
