Precedence is showing the order in which operators are evaluated while the code runs.

 


The table below lists all groovy operators in order of precedence.


Level

Operator(s)

Name(s)











1

new  
()
object creation, explicit parentheses
()  
{}

[]
method call, closure, literal list/map
.  
.&
  
.@
member access, method closure, field/attribute access
?.  
*

*.
  
*:
safe dereferencing, spread, spread-dot, spread-map
~  

!


(type)
bitwise negate/pattern, not, typecast
[]  

++









list/map/array index, post inc/decrement
  

2


**
power
   
3++  

  
+
  

pre inc/decrement, unary plus, unary minus
   
4

*  
/
  



%

multiply, div, remainder
   
5

+  





addition, subtraction
   
6<<
>>
  
>>>
  
..
  
..<
left/right (unsigned) shift, inclusive/exclusive range
   

7



<  
<=
  
>
  
>=
  



in

  
instanceof
  
as
less/greater than/or equal, in, instanceof, type coercion
   
8
==  
!=
  

<=>
equals, not equals, compare to
   



9

=~  
==~
regex find, regex match
&binary/bitwise and
  
10^binary/bitwise xor
   
11|binary/bitwise or
   
12
&&
logical and
   
13
||
logical or
   
14? :ternary conditional
   



15

?:elvis operator
=  
**=

*=
  
/=
  
%=
  
+=

-=
 
various assignments
<<=  
>>=
  
>>>=
  
&=
  
^=

|=

Source http://groovy-lang.org/operators.html

 

I have left the table intact showing all possible operators that are allowed in groovy programming language.

I have highlighted the ones we discussed in the previous posts.

 

However keep in mind that doing scripts in application composer you will  not be using most of this operators.

Leave a Reply

Your email address will not be published. Required fields are marked *