title: Map to 2d array with Streams
body: <p>I am trying to create a 2d array of <code>String</code> using Streams:</p>
  
  <pre><code>String[] fruit1DArray;
  String[][] fruit2DArray;
  
  Map&lt;String, String&gt; fruitMap = new HashMap&lt;&gt;();
  fruitMap.put("apple", "red");
  fruitMap.put("pear", "green");
  fruitMap.put("orange", "orange");
  
  fruit1DArray = fruitMap.entrySet()
      .stream()
      .map(key -&gt; key.getKey())
      .toArray(size -&gt; new String[size]);
  
  fruit2DArray = fruitMap.entrySet()
      .stream()
      .map(entry-&gt; new String[]{entry.getKey()})
      .toArray(size -&gt; new String[size][1]);
  
  System.out.println(Arrays.deepToString(fruit1DArray));
  System.out.println(Arrays.deepToString(fruit2DArray));
  </code></pre>
  
  <p>The output is: </p>
  
  <pre><code>[orange, apple, pear]
  [[orange], [apple], [pear]]
  </code></pre>
  
  <p>The output I am after is:</p>
  
  <pre><code>[orange, apple, pear]
  [[orange, orange], [apple, red], [pear, green]]
  </code></pre>
  
  <p>I am referring <a href="https://stackoverflow.com/a/47397601/887235">https://stackoverflow.com/a/47397601/887235</a></p>