
org.sonar.l10n.squidjava.rules.squid.S1155.html Maven / Gradle / Ivy
Using Collection.size()
to test for emptiness works, but using Collection.isEmpty()
makes the code more readable.
The following code:
if (myCollection.size() == 0) { // Non-Compliant
/* ... */
}
should be refactored into:
if (myCollection.isEmpty()) { // Compliant
/* ... */
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy