forked from phoedos/pmd
toUpperCase() should compare to a capitalized string
This commit is contained in:
@ -3204,9 +3204,9 @@ Using equalsIgnoreCase() is faster than using toUpperCase/toLowerCase().equals()
|
|||||||
<priority>3</priority>
|
<priority>3</priority>
|
||||||
<example>
|
<example>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
boolean answer1 = buz.toUpperCase().equals("baz"); // should be buz.equalsIgnoreCase("baz")
|
boolean answer1 = buz.toUpperCase().equals("BAZ"); // should be buz.equalsIgnoreCase("BAZ")
|
||||||
|
|
||||||
boolean answer2 = buz.toUpperCase().equalsIgnoreCase("baz"); // another unnecessary toUpperCase()
|
boolean answer2 = buz.toUpperCase().equalsIgnoreCase("BAZ"); // another unnecessary toUpperCase()
|
||||||
]]>
|
]]>
|
||||||
</example>
|
</example>
|
||||||
</rule>
|
</rule>
|
||||||
|
Reference in New Issue
Block a user