I searched for similar questions but I found only for the object String which dont apply to this case:
Want to convert List<List<Integer>> list
to int[][] array
using streams
So far I got this:
int[][] array= list.stream().map(List::toArray)...
I used as a base other similar questions I found. But these use String and can't make it work for Integers->int:
// Example with String 1:
String[][] array = list.stream()
.map(l -> l.stream().toArray(String[]::new))
.toArray(String[][]::new);
// Example with String 2:
final List<List<String>> list = ...;
final String[][] array = list.stream().map(List::toArray).toArray(String[][]::new);