I'm new to using streams in java and I have a question on using streams. I have a double[][] in which i want to perform the summation of elements, for it I've written the following approach similar to C#Linq, but it doesn't seem to work.
Arrays.stream(myArray).reduce(0,(acc, i) -> acc + Arrays.stream(i).sum());
The error is that acc seems to be a double[], so it can't perform double[]+double. In C#Linq the accumulator is assumed to be the same type as the seed(0 in this case). What am I missing here? Thanks in advance.