
resources.report.rules.pmd.UnnecessaryCaseChange.html Maven / Gradle / Ivy
UnnecessaryCaseChange
UnnecessaryCaseChange
Using equalsIgnoreCase() is faster than using toUpperCase/toLowerCase().equals()
This rule is defined by the following Java class:
net.sourceforge.pmd.rules.strings.UnnecessaryCaseChange
Example:
public class Foo {
public boolean bar(String buz) {
// should be buz.equalsIgnoreCase("baz")
return buz.toUpperCase().equals("baz");
// another unnecessary toUpperCase()
// return buz.toUpperCase().equalsIgnoreCase("baz");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy