title: Group and sum collection in Groovy
body: <p>I have a collection of objects that I want to group by month and name and sum total:</p>
  
  <pre><code>def things = [
      [id:1, name:"fred", total:10, date: "2012-01-01"],
      [id:2, name:"fred", total:10, date: "2012-01-03"],
      [id:3, name:"jane", total:10, date: "2012-01-04"],
      [id:4, name:"fred", total:10, date: "2012-02-11"],
      [id:5, name:"jane", total:10, date: "2012-01-01"],
      [id:6, name:"ted", total:10, date: "2012-03-21"],
      [id:7, name:"ted", total:10, date: "2012-02-09"]
  ];
  </code></pre>
  
  <p>I would like the output to be:</p>
  
  <pre><code>[
   "fred":[[total:20, month:"January"],[total:10, month:"February"]],
   "jane":[[total:20,month:"January"]],
   "ted" :[[total:10, month:"February"],[total:10, month:"March"]]
  ]
  </code></pre>
  
  <p>or something along those lines. What is the best way to accomplish this using groovy/grails?</p>