sparkyspider
sparkyspider

Reputation: 13519

Groovy Spread Operator with metaClass

Why does this not work?

    shareholders*.metaClass.editing = false;

But this does?

    shareholders.collect{it.metaClass.editing = false}

Upvotes: 0

Views: 87

Answers (1)

tim_yates
tim_yates

Reputation: 171114

you can't assign multiple values that way in groovy, [1, 2, 3] = 4 won't work either

and unless you need a list of false, you're probably better using each instead of collect

Upvotes: 2

Related Questions