title: How to find sum in Java 8 based on a property of an object
body: <p>I have a class defined like this:</p>
  
  <pre><code>public class Item {
  
      String name;
      double price;
  }
  </code></pre>
  
  <p>Now I have a list of Item objects, now I want to find total price for all the items. How can we do this in Java 8?</p>
  
  <p>If the list is of simple integers then we have solution given here - <a href="https://stackoverflow.com/questions/30125296/how-to-sum-a-list-of-integers-with-java-streams">How to sum a list of integers with java streams?</a></p>