Chapter 3. Simple Groovy datatypes

This chapter covers

  • Groovy’s approach to typing
  • Operators as method implementations
  • Strings, regular expressions, and numbers

Do not worry about your difficulties in mathematics. I can assure you mine are still greater.

Albert Einstein

Groovy supports a limited set of datatypes at the language level; that is, it offers constructs for literal declarations and specialized operators. This set contains the simple datatypes for strings, regular expressions, and numbers, as well as the collective datatypes for ranges, lists, and maps. This chapter covers simple datatypes; the next chapter introduces collective datatypes.

Before we go into details, we’ll talk about Groovy’s general approach to typing. With this ...

Get Groovy in Action, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.