title: Computing sum and sum-of-squares at the same time with Streams
body: <p>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.</p>
  
  <pre><code>double sum = Arrays.stream(doubles).sum();
  double sumOfSquares = Arrays.stream(doubles).map(d -&gt; d * d).sum();
  </code></pre>