title: sort list by date in descending order - groovy madness
body: <p>I'm not able to sort a list of Objects by a Date in descending order</p>
  <p>Let's say this is my class <code>Thing</code></p>
  <pre><code>class Thing {
  
  Profil profil
  String status = 'ready'
  Date dtCreated = new Date()
  }
  </code></pre>
  <p>Inside the method I'm creating the <code>List things</code></p>
  <pre><code>            List profiles = profil.xyz?.collect { Profil.collection.findOne(_id:it) }
  
              List things = []
  </code></pre>
  <p>and then I populate the list with each associated <code>Thing</code> of each profile</p>
  <pre><code>            profiles.each() { profile,i -&gt;
                  if(profile) {
                      things += Thing.findAllByProfilAndStatus(profile, &quot;ready&quot;, [sort: 'dtCreated', order: 'desc']) as 
                   }
  </code></pre>
  <p>Alright, now <code>things</code> has a lot of things in it, unfortunately the  <code>[order: 'desc']</code> was applied to each set of things and iI need to sort the whole list by <code>dtCreated</code>. That works wonderful like</p>
  <pre><code>            things.sort{it.dtCreated}
  </code></pre>
  <p>Fine, now all the things are sorted by date but in the wrong order, the most recent thing is the last thing in the list</p>
  <p>So I need to sort in the opposite direction, I didn't find anything on the web that brought me forward, I tried stuff like</p>
  <pre><code>            things.sort{-it.dtCreated} //doesnt work
              things.sort{it.dtCreated}.reverse() //has no effect
  </code></pre>
  <p>and I'm not finding any groovy approach for such a standard operation, maybe someone has a hint how I can sort my things by date in descending order ? There must be something like orm I used above  <code>[sort: 'dtCreated', order: 'desc']</code>
  or isn't it?</p>