I see no advantage in complying with this agreement. In C, where Boolean types do not exist, it is useful to write
if (5 == variable)
but not
if (variable == 5)
because if you forget one of the eaqual badges you will get
if (variable = 5)
which assigns the variable 5 and always evaluates to true. But in Java, the boolean is boolean. And with! =, There is no reason.
One good piece of advice, however, is to write
if (CONSTANT.equals(myString))
but not
if (myString.equals(CONSTANT))
because it helps to avoid NullPointerExceptions.
My advice would be to ask for an excuse for the rule. If they are not, why should they follow? This does not help readability.
source share