title: Java Streams - Standard Deviation
body: <p>I wish to clarify upfront I am looking for a way to calculate Standard deviation using Streams (I have a working method at present which calculates &amp; returns SD but without using Streams).</p>
  
  <p>The dataset i am working with matches closely as seen in <a href="https://stackoverflow.com/questions/26340688/group-by-and-sum-objects-like-in-sql-with-java-lambdas/26341146#26341146">Link</a>. As shown in this link am able to group my data &amp; get the average but not able to figure out how to get the SD.</p>
  
  <p><strong><em>Code</em></strong></p>
  
  <pre><code>outPut.stream()
              .collect(Collectors.groupingBy(e -&gt; e.getCar(),
                      Collectors.averagingDouble(e -&gt; (e.getHigh() - e.getLow()))))
              .forEach((car,avgHLDifference) -&gt; System.out.println(car+ "\t" + avgHLDifference));
  </code></pre>
  
  <p>I also checked <a href="https://groups.google.com/forum/#!topic/javaposse/B1t-ViNSXGw" rel="noreferrer">Link</a> on DoubleSummaryStatistics but it doesn't seem to help for SD.</p>