Appendix B. Groovy by feature

Some people learn by example. Some people learn by feature. In this book I’m trying to satisfy both. If you’re a Java developer with only passing familiarity with Groovy, hopefully either this appendix or chapter 2, “Groovy by example,” will bring you up to speed on the Groovy language.

This appendix walks through most of the major features of Groovy and provides short snippets of code illustrating them. While this chapter does not claim to be an exhaustive reference like Groovy in Action (Manning, 2007; called GinA in the rest of this appendix), it has a couple of features that favor it over the more comprehensive treatment: (1) it’s considerably shorter, and (2) it has the words “Don’t Panic!” written in nice, friendly letters in the appendix (in this sentence, actually).[1] More seriously, in this appendix I review the major features of the Groovy programming language that are used throughout the book.

1 For those born too late, that was a Hitchhiker’s Guide to the Galaxy reference. I could go on to say that this chapter “contains much that is apocryphal, or at least wildly inaccurate,” but that probably wouldn’t be good for sales.

B.1. Scripts and the traditional example

B.2. Variables, numbers, and strings

B.3. Plain Old Groovy Objects

B.4. Collections

B.5. Closures

B.6. Loops and conditionals

B.7. File I/O

B.8. XML

B.9. JSON support

sitemap