title: Convert Map<A, Map<B, C>> to Map<B, Map<A, C>> using streams
body: <p>I have structure map of maps like: </p>
  
  <pre><code>Map&lt;Center, Map&lt;Product, Value&gt;&gt; given
  </code></pre>
  
  <p>and I want to get </p>
  
  <pre><code>Map&lt;Product, Map&lt;Center, Value&gt;&gt; result
  </code></pre>
  
  <p>I've used Java streams </p>
  
  <pre><code>Map&lt;Product, Map&lt;Center, Value&gt;&gt; result = given.entrySet().stream()
          .flatMap(entry -&gt; entry.getValue()
                   .entrySet().stream()
                   .map(e -&gt; Triple(entry.getKey(), e.getKey(), e.getValue())))
          .collect(Collectors.groupingBy(Triple::getProduct,
                      Collectors.toMap(Triple::getCenter, Triple::getValue)));
  </code></pre>
  
  <p>where <code>Triple</code> is simple value class. My questions is if it is possible to do it functional without using additional classes like <code>Triple</code> or e.g. <code>Table</code> from guava?</p>