I am running into trouble with how to sum two 2D arrays elementwise. I have referenced another post: Java 8 Stream and operation on arrays, and understand how to do this with two 1D arrays but how do you now progress through the rows of a 2D array?
//in this example a[] and b[] are Square matrices
int[] A = [n][n]
int[] B = [n][n]
int[] result = new int[A.length][A[0].length];
//I know this only adds the first rows together.
//How do I now iterate through the rows to sum the entire matrix elementwise
result[0] = IntStream.range(0, A.length).map(i -> A[0][i] + B[0][i]).toArray();
I should add that the end goal is to do a threadsafe parallel stream implementation.