PMD on PMD: UseCollectionIsEmpty

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4753 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Xavier Le Vourch
2006-10-26 23:55:50 +00:00
parent 3e7b44fb80
commit 75664112cf
3 changed files with 4 additions and 4 deletions

View File

@ -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)) {

View File

@ -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();
}

View File

@ -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();
}
}