Groovy web console

subscribe to the feed Subscribe
to this
site

Filter and transform list

Published 2 years ago by Andy Duncan with tags collections
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
def x = [1, 2, 3]
def p = { it > 2 }
def t = { it * 2 }
x.findAll(p).collect(t)