Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added a table showing some operators with some names, including the missing spaceship operator <=>


Table of Contents

Arithmetic and Conditional Operators


Elvis Operator (?: )


For more details, see: Regular Expressions

Table of Operators

Operator Name





Useful in comparisons, returns -1 if left is smaller 0 if == to right or 1 if greater than the right

Regex find


Find with a regular expresion? See Regular Expressions

Regex match


Get a match via a regex? See Regular Expressions

Java Field Override


Can be used to override generated properties to provide access to a field



Used to invoke an action on all items of an aggregate object

Spread Java Field


Amalgamation of the above two

Method Reference


Get a reference to a method, can be useful for creating closures from methods

asType Operator


Used for groovy casting, coercing one type to another.

Membership Operator


Can be used as replacement for collection.contains()

Identity Operator


Identity check. Since == is overridden in Groovy with the meaning of equality we need some fallback to check for object identity.

Safe Navigation


returns nulls instead of throwing NullPointerExceptions

Elvis Operator


Shorter ternary operator