December 2013
Beginner to intermediate
222 pages
5h 13m
English
Groovy offers many enhancements to the standard Java collection classes. We’ll take a look at the three collection types that are most used in Grails. The List, Map, and Set are powerful tools, and Groovy gives them a new edge. We know—technically Map is not a collection; that is, it does not implement the Collection interface. But for our purposes, it is a collection in that it holds objects. So, leaving semantic sensitivities aside, let’s look at what Groovy has done for these classes.
One of the first interesting things to learn about the List in Groovy is that it can be created with a literal declaration.
| introduction.2/groovy_list.groovy | |
| | def colors = ['Red', 'Green', 'Blue', 'Yellow'] |
| | def empty = ... |
Read now
Unlock full access