Class UseCollectionIsEmptyRule

java.lang.Object
net.sourceforge.pmd.properties.AbstractPropertySource
net.sourceforge.pmd.lang.rule.AbstractRule
net.sourceforge.pmd.lang.java.rule.AbstractJavaRule
net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule
net.sourceforge.pmd.lang.java.rule.bestpractices.UseCollectionIsEmptyRule
All Implemented Interfaces:
net.sourceforge.pmd.lang.ast.AstVisitor, JavaVisitor, net.sourceforge.pmd.lang.rule.Rule, net.sourceforge.pmd.properties.PropertySource

public class UseCollectionIsEmptyRule extends AbstractJavaRulechainRule
Detect structures like "foo.size() == 0" and suggest replacing them with foo.isEmpty(). Will also find != 0 (replaceable with !isEmpty()).
Author:
Jason Bennett
  • Constructor Details

    • UseCollectionIsEmptyRule

      public UseCollectionIsEmptyRule()
  • Method Details