5. Groovy Closure


Groovy closure is one of feature available on groovy. The function of this feature is like a method in java or any other programming language. We can modify variable, assign parameters or even manipulate a method. The differences between java method and groovy closure is :
1. Java method needs object initialization from the class that contain method we need. On the other hand, groovy doesn’t need that.
2. There is no visibility in groovy closure. But every single method in java must have visibility(public, private, protected).
3. There is differences in the way to write the code
Based on list above, actually we don’t have to worry about which one that we have to use in groovy, because we can use both of them whether java method or groovy closure. This is the sample code to use groovy closure.

Tagged: , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: