Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Current »

Boolean expressions

Groovy supports the standard conditional operators on boolean expressions, e.g.:

In addition, Groovy has special rules for coercing non-boolean objects to a boolean value.


Empty collections are coerced to false.

Iterators and Enumerations

Iterators and Enumerations with no further elements are coerced to false.


Non-empty maps are coerced to true.


Matching regex patterns are coerced to true.


Non-empty Strings, GStrings and CharSequences are coerced to true.


Non-zero numbers are coerced to true.

Object references

Non-null object references are coerced to true.

  • No labels