Vipin :
Inversion sum is not correct using Stream.reduce, what is going wrong here ?
double[] array = {1.0, 2.0};
double iunversionSum = Arrays.stream(array).reduce(0.0, (a, b) -> Double.sum(1.0 / a, 1.0 / b));
output is .5 but expected is 1.5 (1/1 + 1/2)
oleg.cherednik :
I think using map()
it could be simplier.
double inversionSum = Arrays.stream(arr).map(val -> 1 / val).sum();