Thursday, November 24, 2011

Spread-dot, a Terse Syntax for Collect or Each

List foo = ['a','bc']
assert (foo*.size() == foo.collect{it.size()})
// *. is basically a super terse syntax for .collect -- i.e. call exactly one operation on each 'it'
// also, if you don't want to save the results, * is basically a super terse .each
threads*.join()

No comments:

Post a Comment