Appendix B. Groovy language info

Table B.1 lists all the Groovy operators in order of their precedence. Most of these operators can be overridden. See the respective method names and usages in section 3.3, table 3.4.

Table B.1. Groovy operators in order of precedence

Level

Operator

Note

1

$x

new ()

() {} []

. ?. *.

~ ! $ (type)

Scope escape

Explicit parentheses

Method call, closure, list/map

Dot, safe dereferencing, spread-dot

Negate, not, typecast

2

**

Power

3

++ -- + -

Pre/post increment/decrement, unary sign

4

* / %

Multiply, div, modulo

5

+ -

Binary

6

<< >> >>> .. ..<

Shift, range

7

< <= > >= instanceof as

 

8

== != <=>

 

9

&

Binary and

10

^

Binary xor

11

|

Binary or

12

&&

Logical and

13

||

Logical or

14

?:

Ternary conditional

15

= **= *= /= %= += -= <<= >>= >>>= &= ^= |=

Assignments

The ...

Get Groovy in Action 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.