mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
wording, example added
This commit is contained in:
+12
-2
@@ -1,7 +1,17 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection reports <b>==</b> and <b>!=</b> equality operators that compare two objects.
|
||||
<p>The quick fix offers to replace the equality operators with calls of the <b>.equals()</b> method
|
||||
or with the safe <b>.equals()</b> method construct.
|
||||
For example:<br> <code><b>if</b> (object1 == object2) {}</code>
|
||||
<p>Quick fix replaces '==' with <b>.equals()</b>:
|
||||
<p><code>object1.equals(object2);</code>
|
||||
<p>or with safe <b>.equals()</b>:
|
||||
<ul>
|
||||
<li>
|
||||
<code>java.util.Objects.equals(object1, object2)</code><br> (under Java7+) or
|
||||
</li>
|
||||
<li>
|
||||
<code>object1 == null ? object2 == null : object1.equals(object1)</code><br> (under old JDKs)
|
||||
</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user