title: Checking if a collection is empty in Java: which is the best method?
body: <p>I have two ways of checking if a List is empty or not</p>
  
  <pre><code>if (CollectionUtils.isNotEmpty(listName)) 
  </code></pre>
  
  <p>and </p>
  
  <pre><code>if (listName != null &amp;&amp; listName.size() != 0)
  </code></pre>
  
  <p>My arch tells me that the former is better than latter. But I think the latter is better.</p>
  
  <p>Can anyone please clarify it?</p>