title: Java - Flatten nested map using Stream
body: <p>I have been messing around with Java 8 Stream API and ran into something I could only do through traditional for-loops.</p>
  
  <p>Given a nested map of</p>
  
  <pre><code>{
      1999: {
               3: [23, 24, 25],
               4: [1, 2, 3]
            },
      2001: {
               11: [12, 13, 14],
               12: [25, 26, 27]
  
            }
  }
  </code></pre>
  
  <p>How can I transform this into</p>
  
  <pre><code>['23,3,1999', '24,3,1999', '25,3,1999', '1,4,1999', '2,4,1999', '3,4,1999', '12,11,2001', '13,11,2001', '14,11,2001', '25,12,2001', '26,12,2001', '27,12,2001']
  </code></pre>
  
  <p>Basically I want to replicate: </p>
  
  <pre><code>    Map&lt;Integer, Map&lt;Integer, List&lt;Integer&gt;&gt;&gt; dates...
      List&lt;String&gt; flattened = new ArrayList&lt;&gt;();
      for (Integer key1 : map.keySet()) {
          for (Integer key2 : map.get(key1).keySet()) {
              for (Integer value : map.get(key1).get(key2)) {
                  flattened.add(value + "," + key2 + "," + key1);
              }
          }
      }
  </code></pre>