title: java8 stream sum multiple
body: <p>I am curious, how to sum up multiple variables in a java8 stream.</p>
  
  <pre><code>Integer wCPU = 0;
  Double wnetwork = 0.0;
  Double wMem = 0.0;
  
  this.slaContractList.forEach(sla -&gt; {
      wCPU += sla.getNumberOfCPUs();
      wnetwork += sla.getNetworkBandwith();
      wMem += sla.getMemory();
  });
  </code></pre>
  
  <p>However, this does not compile as the variable in the lambda expression should be final.</p>