By jsugrue
via java.dzone.com
Published: Oct 18 2012 / 08:24
Since Groovy 1.8.7 we can create a list and use the withDefault() method to define a default value for elements that are not yet in the list. We use a closure as argument of the method, which returns the default value. We can even access the index of the element in the closure as an argument.
Add your comment