Chapter 2. Groovy by example

This chapter covers

  • Basic Groovy syntax
  • Collections and closures
  • Using the Groovy JDK

As the previous chapter stated, this book isn’t intended to be an exhaustive reference for Groovy, but a certain minimum level of Groovy proficiency is necessary. While some people learn best through short, simple code examples illustrating each concept, others prefer to see basic concepts combined to solve actual problems. For those who prefer snippets of code for each feature I’ve provided appendix B, a Groovy tutorial arranged by feature.

In this chapter, I’ll instead walk through a few small but non-trivial Groovy examples. Hopefully this will help communicate not only the syntax of the language, but some of the standard ...

Get Making Java Groovy: Foreword by Guillaume Laforge now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.