Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Groovyでリスト内包表記
// Groovyでリスト内包表記
// see: http://en.wikipedia.org/wiki/List_comprehensions
def listComprehension(list, filter, expr) {
list.findAll(filter).collect(expr)
}
println listComprehension(
(0..10).toList(),
{it % 2 == 0},
{"<${it * 3}>"}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.