Skip to content

Commit

Permalink
fix up optional.equals check
Browse files Browse the repository at this point in the history
  • Loading branch information
mebigfatguy committed Oct 22, 2021
1 parent db220ba commit b194c6b
Show file tree
Hide file tree
Showing 2 changed files with 361 additions and 336 deletions.
15 changes: 14 additions & 1 deletion etc/messages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6122,7 +6122,20 @@ if (shouldCalcHalting && (calculateHaltingProbability() > 0) { }
<Details>
<![CDATA[
<p>This method uses Optional.equals(Optional.empty()). It is more readable and more clear just to use the Optional.isPresent()
method to determine whether the reference exists or not.
method to determine whether the reference exists or not. Use
<br/>
<pre><code>
Optional f = getSomeOptional();
if (!f.isPresent()) {
}
</code></pre>
rather than
<br/>
<pre><code>
Optional f = getSomeOptional();
if (f.equals(Optional.empty()) {
}
</code></pre>
</p>
]]>
</Details>
Expand Down
Loading

0 comments on commit b194c6b

Please sign in to comment.