Java, Streams: how to convert expression with.collect(Collectors.toList())
<p>How can I convert</p>

<pre><code>List&lt;Integer&gt; list = new ArrayList&lt;&gt;();
IntStream.range(0, 10).forEach(i -&gt; IntStream.range(0, i + 1).forEach(j -&gt; list.add(Math.max(i, j))));
</code></pre>

<p>into a single line expression like</p>

<pre><code>List&lt;Integer&gt; list = IntStream.range(0, 10) ... .collect(Collectors.toList());
</code></pre>