[[painless-operators]]
=== Operators

An operator is the most basic action that can be taken to evaluate values in a
script. An expression is one-to-many consecutive operations.  Precedence is the
order in which an operator will be evaluated relative to another operator.
Associativity is the direction within an expression in which a specific operator
is evaluated.  The following table lists all available operators:

[cols="<6,<3,^3,^2,^4"]
|====
| *Operator*                                                | *Category*                                  | *Symbol(s)* | *Precedence* | *Associativity*
| <<precedence-operator, Precedence>>                       | <<painless-operators-general, General>>     | ()          | 0            | left -> right
| <<method-call-operator, Method Call>>                     | <<painless-operators-reference, Reference>> | . ()        | 1            | left -> right
| <<field-access-operator, Field Access>>                   | <<painless-operators-reference, Reference>> | .           | 1            | left -> right
| <<null-safe-operator, Null Safe>>                         | <<painless-operators-reference, Reference>> | ?.          | 1            | left -> right
| <<function-call-operator, Function Call>>                 | <<painless-operators-general, General>>     | ()          | 1            | left -> right
| <<array-initialization-operator, Array Initialization>>   | <<painless-operators-array, Array>>         | [] {}       | 1            | left -> right
| <<array-access-operator, Array Access>>                   | <<painless-operators-array, Array>>         | []          | 1            | left -> right
| <<array-length-operator, Array Length>>                   | <<painless-operators-array, Array>>         | .           | 1            | left -> right
| <<list-initialization-operator, List Initialization>>     | <<painless-operators-reference, Reference>> | []          | 1            | left -> right
| <<list-access-operator, List Access>>                     | <<painless-operators-reference, Reference>> | []          | 1            | left -> right
| <<map-initialization-operator, Map Initialization>>       | <<painless-operators-reference, Reference>> | [:]         | 1            | left -> right
| <<map-access-operator, Map Access>>                       | <<painless-operators-reference, Reference>> | []          | 1            | left -> right
| <<post-increment-operator, Post Increment>>               | <<painless-operators-numeric, Numeric>>     | ++          | 1            | left -> right
| <<post-decrement-operator, Post Decrement>>               | <<painless-operators-numeric, Numeric>>     | --          | 1            | left -> right
| <<pre-increment-operator, Pre Increment>>                 | <<painless-operators-numeric, Numeric>>     | ++          | 2            | right -> left
| <<pre-decrement-operator, Pre Decrement>>                 | <<painless-operators-numeric, Numeric>>     | --          | 2            | right -> left
| <<unary-positive-operator, Unary Positive>>               | <<painless-operators-numeric, Numeric>>     | +           | 2            | right -> left
| <<unary-negative-operator, Unary Negative>>               | <<painless-operators-numeric, Numeric>>     | -           | 2            | right -> left
| <<boolean-not-operator, Boolean Not>>                     | <<painless-operators-boolean, Boolean>>     | !           | 2            | right -> left
| <<bitwise-not-operator, Bitwise Not>>                     | <<painless-operators-numeric, Numeric>>     | ~           | 2            | right -> left
| <<cast-operator, Cast>>                                   | <<painless-operators-general, General>>     | ()          | 3            | right -> left
| <<new-instance-operator, New Instance>>                   | <<painless-operators-reference, Reference>> | new ()      | 3            | right -> left
| <<new-array-operator, New Array>>                         | <<painless-operators-array, Array>>         | new []      | 3            | right -> left
| <<multiplication-operator, Multiplication>>               | <<painless-operators-numeric, Numeric>>     | *           | 4            | left -> right
| <<division-operator, Division>>                           | <<painless-operators-numeric, Numeric>>     | /           | 4            | left -> right
| <<remainder-operator, Remainder>>                         | <<painless-operators-numeric, Numeric>>     | %           | 4            | left -> right
| <<string-concatenation-operator, String Concatenation>>   | <<painless-operators-reference, Reference>> | +           | 5            | left -> right
| <<addition-operator, Addition>>                           | <<painless-operators-numeric, Numeric>>     | +           | 5            | left -> right
| <<subtraction-operator, Subtraction>>                     | <<painless-operators-numeric, Numeric>>     | -           | 5            | left -> right
| <<left-shift-operator, Left Shift>>                       | <<painless-operators-numeric, Numeric>>     | <<          | 6            | left -> right
| <<right-shift-operator, Right Shift>>                     | <<painless-operators-numeric, Numeric>>     | >>          | 6            | left -> right
| <<unsigned-right-shift-operator, Unsigned Right Shift>>   | <<painless-operators-numeric, Numeric>>     | >>>         | 6            | left -> right
| <<greater-than-operator, Greater Than>>                   | <<painless-operators-boolean, Boolean>>     | >           | 7            | left -> right
| <<greater-than-or-equal-operator, Greater Than Or Equal>> | <<painless-operators-boolean, Boolean>>     | >=          | 7            | left -> right
| <<less-than-operator, Less Than>>                         | <<painless-operators-boolean, Boolean>>     | <           | 7            | left -> right
| <<less-than-or-equal-operator, Less Than Or Equal>>       | <<painless-operators-boolean, Boolean>>     | +++<=+++    | 7            | left -> right
| <<instanceof-operator, Instanceof>>                       | <<painless-operators-boolean, Boolean>>     | instanceof  | 8            | left -> right
| <<equality-equals-operator, Equality Equals>>             | <<painless-operators-boolean, Boolean>>     | ==          | 9            | left -> right
| <<equality-not-equals-operator, Equality Not Equals>>     | <<painless-operators-boolean, Boolean>>     | !=          | 9            | left -> right
| <<identity-equals-operator, Identity Equals>>             | <<painless-operators-boolean, Boolean>>     | ===         | 9            | left -> right
| <<identity-not-equals-operator, Identity Not Equals>>     | <<painless-operators-boolean, Boolean>>     | !==         | 9            | left -> right
| <<bitwise-and-operator, Bitwise And>>                     | <<painless-operators-numeric, Numeric>>     | &           | 10           | left -> right
| <<boolean-xor-operator, Boolean Xor>>                     | <<painless-operators-boolean, Boolean>>     | ^           | 11           | left -> right
| <<bitwise-xor-operator, Bitwise Xor>>                     | <<painless-operators-numeric, Numeric>>     | ^           | 11           | left -> right
| <<bitwise-or-operator, Bitwise Or>>                       | <<painless-operators-numeric, Numeric>>     | \|          | 12           | left -> right
| <<boolean-and-operator, Boolean And>>                     | <<painless-operators-boolean, Boolean>>     | &&          | 13           | left -> right
| <<boolean-or-operator, Boolean Or>>                       | <<painless-operators-boolean, Boolean>>     | \|\|        | 14           | left -> right
| <<conditional-operator, Conditional>>                     | <<painless-operators-general, General>>     | ? :         | 15           | right -> left
| <<elvis-operator, Elvis>>                                 | <<painless-operators-general, General>>     | ?:          | 16           | right -> left
| <<assignment-operator, Assignment>>                       | <<painless-operators-general, General>>     | =           | 17           | right -> left
| <<compound-assignment-operator, Compound Assignment>>     | <<painless-operators-general, General>>     | $=          | 17           | right -> left
|====
