Enum BinaryOperator

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      ADD
      Addition, +; also string concatenation when either operand is a string.
      ADD_ASSIGN
      Add and assign, +=; also string append-assign.
      AND
      Short-circuiting logical and, &&; the right operand is skipped when the left is false.
      ASSIGN
      Plain assignment, =; the lowest-precedence operator and the only non-compound one that groups right to left.
      BAND
      Bitwise and, &; on boolean operands a logical and that always evaluates both sides.
      BAND_ASSIGN
      Bitwise and and assign, &=; also non-short-circuiting and-assign on booleans.
      BOR
      Bitwise or, |; on boolean operands a logical or that always evaluates both sides.
      BOR_ASSIGN
      Bitwise or and assign, |=; also non-short-circuiting or-assign on booleans.
      BXOR
      Bitwise exclusive or, ^; logical xor on boolean operands.
      BXOR_ASSIGN
      Bitwise exclusive-or and assign, ^=; also logical xor-assign on booleans.
      DIV
      Division, /, truncating toward zero on integral operands.
      DIV_ASSIGN
      Divide and assign, /=.
      EQ
      Equality test, ==; reference identity when the operands are references.
      GE
      Greater-than-or-equal relational test, >=.
      GT
      Greater-than relational test, >.
      LE
      Less-than-or-equal relational test, <=.
      LT
      Less-than relational test, <.
      MOD
      Remainder, %, which takes the sign of the dividend.
      MOD_ASSIGN
      Remainder and assign, %=.
      MUL
      Multiplication, *.
      MUL_ASSIGN
      Multiply and assign, *=.
      NE
      Inequality test, !=; reference identity when the operands are references.
      OR
      Short-circuiting logical or, ||; the right operand is skipped when the left is true.
      SHL
      Left shift, <<.
      SHL_ASSIGN
      Left shift and assign, <<=.
      SHR
      Signed right shift, >>, which preserves the sign bit.
      SHR_ASSIGN
      Signed right shift and assign, >>=.
      SUB
      Subtraction, -.
      SUB_ASSIGN
      Subtract and assign, -=.
      USHR
      Unsigned right shift, >>>, which fills the vacated high bits with zeroes regardless of sign.
      USHR_ASSIGN
      Unsigned right shift and assign, >>>=.
    • Enum Constant Detail

      • ADD

        public static final BinaryOperator ADD
        Addition, +; also string concatenation when either operand is a string.
      • DIV

        public static final BinaryOperator DIV
        Division, /, truncating toward zero on integral operands.
      • MOD

        public static final BinaryOperator MOD
        Remainder, %, which takes the sign of the dividend.
      • BAND

        public static final BinaryOperator BAND
        Bitwise and, &; on boolean operands a logical and that always evaluates both sides.
      • BOR

        public static final BinaryOperator BOR
        Bitwise or, |; on boolean operands a logical or that always evaluates both sides.
      • BXOR

        public static final BinaryOperator BXOR
        Bitwise exclusive or, ^; logical xor on boolean operands.
      • SHR

        public static final BinaryOperator SHR
        Signed right shift, >>, which preserves the sign bit.
      • USHR

        public static final BinaryOperator USHR
        Unsigned right shift, >>>, which fills the vacated high bits with zeroes regardless of sign.
      • EQ

        public static final BinaryOperator EQ
        Equality test, ==; reference identity when the operands are references.
      • NE

        public static final BinaryOperator NE
        Inequality test, !=; reference identity when the operands are references.
      • LT

        public static final BinaryOperator LT
        Less-than relational test, <.
      • LE

        public static final BinaryOperator LE
        Less-than-or-equal relational test, <=.
      • GT

        public static final BinaryOperator GT
        Greater-than relational test, >.
      • GE

        public static final BinaryOperator GE
        Greater-than-or-equal relational test, >=.
      • AND

        public static final BinaryOperator AND
        Short-circuiting logical and, &&; the right operand is skipped when the left is false.
      • OR

        public static final BinaryOperator OR
        Short-circuiting logical or, ||; the right operand is skipped when the left is true.
      • ASSIGN

        public static final BinaryOperator ASSIGN
        Plain assignment, =; the lowest-precedence operator and the only non-compound one that groups right to left.
      • ADD_ASSIGN

        public static final BinaryOperator ADD_ASSIGN
        Add and assign, +=; also string append-assign.
      • SUB_ASSIGN

        public static final BinaryOperator SUB_ASSIGN
        Subtract and assign, -=.
      • MUL_ASSIGN

        public static final BinaryOperator MUL_ASSIGN
        Multiply and assign, *=.
      • DIV_ASSIGN

        public static final BinaryOperator DIV_ASSIGN
        Divide and assign, /=.
      • MOD_ASSIGN

        public static final BinaryOperator MOD_ASSIGN
        Remainder and assign, %=.
      • BAND_ASSIGN

        public static final BinaryOperator BAND_ASSIGN
        Bitwise and and assign, &=; also non-short-circuiting and-assign on booleans.
      • BOR_ASSIGN

        public static final BinaryOperator BOR_ASSIGN
        Bitwise or and assign, |=; also non-short-circuiting or-assign on booleans.
      • BXOR_ASSIGN

        public static final BinaryOperator BXOR_ASSIGN
        Bitwise exclusive-or and assign, ^=; also logical xor-assign on booleans.
      • SHL_ASSIGN

        public static final BinaryOperator SHL_ASSIGN
        Left shift and assign, <<=.
      • SHR_ASSIGN

        public static final BinaryOperator SHR_ASSIGN
        Signed right shift and assign, >>=.
      • USHR_ASSIGN

        public static final BinaryOperator USHR_ASSIGN
        Unsigned right shift and assign, >>>=.
    • Method Detail

      • values

        public static BinaryOperator[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (BinaryOperator c : BinaryOperator.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static BinaryOperator valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getSymbol

        public String getSymbol()
        Returns:
        the symbol
      • getPrecedence

        public int getPrecedence()
        Returns:
        the binding strength, where a higher value binds tighter
      • isLeftAssociative

        public boolean isLeftAssociative()
        Returns:
        true if operands group left to right
      • isAssignment

        public boolean isAssignment()
        Returns:
        true for plain assignment and every compound assignment
      • isComparison

        public boolean isComparison()
        Returns:
        true for the equality and relational operators
      • isLogical

        public boolean isLogical()
        Returns:
        true for the short-circuiting && and || operators
      • isBitwise

        public boolean isBitwise()
        Returns:
        true for the and, or, xor and shift operators