Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You should now be fairly confident in your ability to understand and write Groovy code. So far, most differences between Groovy and Java have fallen under the heading of “syntactic sugar.” We now move on to two important concepts that separate Groovy from Java on a more fundamental level: closures and Groovy’s dynamic nature.
You’re probably familiar with the sort() method in java.util.Collections for sorting a list using a given comparator. This simple fragment of Java code will sort a list of strings, ignoring case, and print them to the console: