people = [ [ name: "barney", dob: new GregorianCalendar(1980, Calendar.JUNE, 10) ], [ name: "heather", dob: new GregorianCalendar(1980, Calendar.FEBRUARY, 12) ] , [ name: "emery", dob: new GregorianCalendar(2005, Calendar.AUGUST, 12) ] ] println("
Name | DOB | """) people.sort({p1, p2 -> p1.name.compareTo(p2.name) } as Comparator) .each { println("
---|---|
${it.name} | ${it.dob.time.format('MMM d, yyyy')} |