View by Classes

Findings - Overview

design UseCollectionIsEmpty (PMD)

Substitute calls to size() == 0 (or size() != 0) with calls to isEmpty()

Further info on the wiki.
The isEmpty() method on java.util.Collection is provided to see if a collection has any elements. Comparing the value of size() to 0 merely duplicates existing behavior.
    
	public class Foo {
		void good() {
        	List foo = getList();
			if (foo.isEmpty()) {
				// blah
			}
    	}

	    void bad() {
    	    List foo = getList();
				if (foo.size() == 0) {
					// blah
				}
	    	}
	}
    
      

Additional info can be found at this http://pmd.sourceforge.net/rules/design.html#UseCollectionIsEmpty site.

1org.jcoderz.commons.util.JaxbUtil
 [279:17]
1org.jcoderz.commons.taskdefs.LuntBuildTask
 [425:9]
1org.jcoderz.phoenix.sqlparser.SqlParser
 [341:14]
1org.jcoderz.phoenix.report.ReportNormalizerAntTask
 [363:11]
1org.jcoderz.phoenix.report.JcoderzReportAntTask
 [376:11]
1org.jcoderz.phoenix.cmpgen2.TypeMapping
 [170:17]