Groovy Truth Add comment to Wiki View in Wiki Edit Wiki page Printable Version

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.

Collections

Empty collections are coerced to false.

Iterators and Enumerations

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

Maps

Non-empty maps are coerced to true.

Matchers

Matching regex patterns are coerced to true.

Strings

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

Numbers

Non-zero numbers are coerced to true.

Object references

Non-null object references are coerced to true.

 

Search

Results of your search request can come from various sources: the Groovy website itself, the JIRA issues, the API documentation, as well as a few other interesting Groovy-related blogs.

  By  -  pages  -  views  - last modified