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


Output of Script

 20 ms

[GROOVY, GRAILS, GRADLE]
[GROOVY, GRAILS, GRADLE]

Comments

Popular posts from this blog

தட்டு வண்டியில் காளிக்கோயில் - சிறுகதை

பிரேமாவின் பெண் குழந்தை

தீபம் பிளக்ஸ்