I was wondering if there is any way to achieve the following within a single iteration over the array. Simply to have two different results out of stream.
double sum = Arrays.stream(doubles).sum();
double sumOfSquares = Arrays.stream(doubles).map(d -> d * d).sum();