title: Writing nested loops with streams
body: <p>I once wrote a replacement for functions like this:  </p>
  
  <pre><code> int[][] createMatrix(int height, int width) {
     int[][] matrix = new int[height][width];
     for (int i = 0; i &lt; height; ++i) {
        for (int j = 0; j &lt; width; ++j) {
           matrix[i][j] = i * width + j;
        }
     }
     return matrix;
  }
  </code></pre>
  
  <p>But now, I found myself unable to do it again. How can that code be refactored to use streams in Java 8?</p>