title: Is it possible to construct a Java stream expression to return a 2D boolean array, all values set to true?
body: <p>I'm learning about stream expressions and trying to use them to construct a 2D boolean array, with all values set to true. Something like:</p>
  <pre><code>boolean[][] bool_array = [stream expression returning a
                               2D array boolean[h][w], all values set to true]
  </code></pre>
  <p>Is this possible to do and what would the expression be?</p>
  <p>I know <code>int[][]</code> arrays may be created using streams, for example</p>
  <pre><code>int h=5;
  int w=8;
  int[][] int_array = IntStream.range(0,h).mapToObj(i-&gt;IntStream.range(0,w).
            map(j-&gt;1).toArray()).toArray(int[][]::new);
  </code></pre>
  <p>returns an <code>int[5][8]</code> filled with ones. But trying to get this to work for <code>boolean[][]</code></p>
  <pre><code>boolean[][] bool_array = IntStream.range(0,h).mapToObj(i-&gt;IntStream.range(0,w).
            mapToObj(j-&gt;true).toArray()).toArray(boolean[][]::new);
  </code></pre>
  <p>throws an <code>ArrayStoreException</code>.</p>