Java sum two double[][] with parallel stream
问题 Let's say I have this two matrices: double[][] a = new double[2][2] a[0][0] = 1 a[0][1] = 2 a[1][0] = 3 a[1][1] = 4 double[][] b = new double[2][2] b[0][0] = 1 b[0][1] = 2 b[1][0] = 3 b[1][1] = 4 in the traditional way, to sum this matrices I would do a nested for loop: int rows = a.length; int cols = a[0].length; double[][] res = new double[rows][cols]; for(int i = 0; i < rows; i++){ for(int j = 0; j < cols; j++){ res[i][j] = a[i][j] + b[i][j]; } } I'm fairly new to the stream API but I