Such comparisons may be confusing: a == b == c
means (a == b) == c
,
but possibly a == b && a == c
is intended.
Example:
boolean chainedEquality(boolean a, boolean b, boolean c) {
return a == b == c;
}
You can use parentheses to make the comparison less confusing:
boolean chainedEquality(boolean a, boolean b, boolean c) {
return (a == b) == c;
}