diff --git a/pmd/src/net/sourceforge/pmd/rules/ConstructorCallsOverridableMethod.java b/pmd/src/net/sourceforge/pmd/rules/ConstructorCallsOverridableMethod.java index 13cb65a61d..d54565eaa6 100644 --- a/pmd/src/net/sourceforge/pmd/rules/ConstructorCallsOverridableMethod.java +++ b/pmd/src/net/sourceforge/pmd/rules/ConstructorCallsOverridableMethod.java @@ -378,7 +378,7 @@ public final class ConstructorCallsOverridableMethod extends AbstractRule { m_Eci = eci; List l = new ArrayList(); eci.findChildrenOfType(ASTArguments.class, l); - if (l.size() > 0) { + if (!l.isEmpty()) { ASTArguments aa = (ASTArguments) l.get(0); count = aa.getArgumentCount(); } @@ -854,7 +854,7 @@ public final class ConstructorCallsOverridableMethod extends AbstractRule { //if this list does not contain our class name, then its not referencing our class //this is a cheezy test... but it errs on the side of less false hits. List packClass = meth.getQualifierNames(); - if (packClass.size() > 0) { + if (!packClass.isEmpty()) { for (Iterator it = packClass.iterator(); it.hasNext();) { String name = (String) it.next(); if (name.equals(className)) { diff --git a/pmd/src/net/sourceforge/pmd/rules/optimization/AbstractOptimizationRule.java b/pmd/src/net/sourceforge/pmd/rules/optimization/AbstractOptimizationRule.java index 89be6c988c..201b0d01d6 100644 --- a/pmd/src/net/sourceforge/pmd/rules/optimization/AbstractOptimizationRule.java +++ b/pmd/src/net/sourceforge/pmd/rules/optimization/AbstractOptimizationRule.java @@ -36,7 +36,7 @@ public class AbstractOptimizationRule extends AbstractRule implements Rule { // TODO - symbol table? protected final String getVarName(ASTLocalVariableDeclaration node) { List l = node.findChildrenOfType(ASTVariableDeclaratorId.class); - if (l != null && l.size() > 0) { + if (l != null && !l.isEmpty()) { ASTVariableDeclaratorId vd = (ASTVariableDeclaratorId) l.get(0); return vd.getImage(); } diff --git a/pmd/src/net/sourceforge/pmd/rules/strictexception/ExceptionSignatureDeclaration.java b/pmd/src/net/sourceforge/pmd/rules/strictexception/ExceptionSignatureDeclaration.java index 107e9202c5..2c830bfd36 100644 --- a/pmd/src/net/sourceforge/pmd/rules/strictexception/ExceptionSignatureDeclaration.java +++ b/pmd/src/net/sourceforge/pmd/rules/strictexception/ExceptionSignatureDeclaration.java @@ -100,6 +100,6 @@ public class ExceptionSignatureDeclaration extends AbstractRule { } private boolean hasContent(List nameList) { - return nameList != null && nameList.size() > 0; + return nameList != null && !nameList.isEmpty(); } }