RosettaCodeData/Task/Multiple-distinct-objects/Groovy/multiple-distinct-objects-2...

3 lines
98 B
Groovy

// Following fails, creates n references to same object
def createFoos2 = {n -> [new Foo()] * n }