title: In Groovy, how do I add up the values for a certain property in a map?
body: <p>I have the following map:</p>
  
  <pre><code>def map = [];
  map.add([ item: "Shampoo", count: 5 ])
  map.add([ item: "Soap", count: 3 ])
  </code></pre>
  
  <p>I would like to get the sum of all the <code>count</code> properties in the map. In C# using LINQ, it would be something like:</p>
  
  <pre><code>map.Sum(x =&gt; x.count)
  </code></pre>
  
  <p>How do I do the same in Groovy?</p>