Java преобразовать 2D массив в 1D -поток
list.stream().flatMap(x -> x.stream()).collect(Collectors.toList());
// or, alternatively, with a 2d array of ints (my use-case):
Arrays.stream(list).flatMapToInt(Arrays::stream).sum();
Glamorous Gull