title: How to get the list of latested objects from a list
body: <p>I have a list of objects (instance of class A):</p>
  
  <pre><code>Class A {
    private String name;
    private Date createdDate;
  }
  
  List [
  A ("a", 01-Jan-2017),
  A ("a", 03-Jan-2017),
  A ("a", 02-Jan-2017),
  A ("b", 05-Jan-2017),
  A ("b", 06-Jan-2017),
  A ("b", 07-Jan-2017),
  .
  .
  .
  A ("x", 02-Jan-2017),
  A ("x", 05-Jan-2017),
  A ("x", 06-Jan-2017),
  A ("x", 07-Jan-2017)
  ]
  </code></pre>
  
  <p>How can I extract a list of class A for each 'name' with latest createdDate.</p>
  
  <p>I,e, expected output is -</p>
  
  <pre><code>List [
      A ("a", 03-Jan-2017),
      A ("b", 07-Jan-2017),
      .
      .
      .
      A ("x", 07-Jan-2017)
      ]
  </code></pre>