title: Summing a map of doubles into an aggregated BigDecimal with Java Streams
body: <p>I'm trying to use the Java 8 Stream API <em>mapToDouble</em> method like so:</p>
  
  <pre><code>BigDecimal totalCost = order.getOrderlineList().stream()
      .mapToDouble(Orderline::getPrice)
      .sum();
  </code></pre>
  
  <p>The problem is that <code>Orderline::getPrice</code> returns a <code>BigDecimal</code>, not a <code>Double</code>. Hence the attempt above fails to compile (<em>Bad return type in method reference: cannot convert java.math.BigDecimal to doubele</em>).</p>
  
  <p>Seeing that <code>Orderline#price</code> is a <code>BigDecimal</code>, how can I use the Stream API (and either <code>mapToDouble</code> or something similar) to get my <code>totalCost</code>?</p>