org.sonar.l10n.java.rules.squid.S2200.html Maven / Gradle / Ivy
The newest version!
While most compareTo
methods return -1, 0, or 1, some do not, and testing the result of a compareTo
against a specific value other than 0 could result in false negatives.
Noncompliant Code Example
if (myClass.compareTo(arg) == -1) { // Noncompliant
// ...
}
Compliant Solution
if (myClass.compareTo(arg) < 0) {
// ...
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy