Using the spread-dot operator
def animals = ['ant', 'buffalo', 'canary', 'dog']
assert animals.size() == 4
assert animals*.size() == [3, 7, 6, 3]
This is a shortcut for animals.collect { it.size() }.
Using the spread-dot operator
def animals = ['ant', 'buffalo', 'canary', 'dog']
assert animals.size() == 4
assert animals*.size() == [3, 7, 6, 3]
This is a shortcut for animals.collect { it.size() }.