Class 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 Detail

      • UseCollectionIsEmptyRule

        public UseCollectionIsEmptyRule()