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("

Average Age

") println(people.sum(0, { new GregorianCalendar() - it.dob }) / people.size() ) println("""

Alphabetic Sort

""") people.sort({p1, p2 -> p1.name.compareTo(p2.name) } as Comparator) .each { println("") } println("
NameDOB
${it.name}${it.dob.time.format('MMM d, yyyy')}
")