Groovy Operator Overloading - Spread Operator
//Spread operator: invoke an action on all items of an aggregate object.
def technologies = ['Groovy','Grails','Gradle']
t1=technologies*.toUpperCase()
t2 = technologies.collect { it?.toUpperCase() }
println t1
println t2
//t1 equivalent to t2
def technologies = ['Groovy','Grails','Gradle']
t1=technologies*.toUpperCase()
t2 = technologies.collect { it?.toUpperCase() }
println t1
println t2
//t1 equivalent to t2
Comments
Post a Comment