mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
20 lines
572 B
HTML
20 lines
572 B
HTML
<html>
|
|
<body>
|
|
Reports chained equality comparisons.
|
|
<p>Such comparisons may be confusing: <code>a == b == c</code> means <code>(a == b) == c</code>,
|
|
but possibly <code>a == b && a == c</code> is intended.</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
boolean chainedEquality(boolean a, boolean b, boolean c) {
|
|
return a == b == c;
|
|
}
|
|
</code></pre>
|
|
<p>You can use parentheses to make the comparison less confusing:</p>
|
|
<pre><code>
|
|
boolean chainedEquality(boolean a, boolean b, boolean c) {
|
|
return (a == b) == c;
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
</body>
|
|
</html> |