Groovy isn't too bad for this example:
@Immutable class Person { String name; Integer age }
def people = [new Person("Boris", 40), new Person("Betty", 32), new
Person("Bambi", 17)]
def (minors, majors) = people.split{ it.age <= 18 }
[minors, majors].each{ println it.join(", ") }
Cheers, Paul.
--
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en.