title: Can an ArrayList be null and have a size > 0?
body: <p>I was reviewing a Java project and saw the following code:</p>
  
  <pre><code>List&lt;XYZ&gt; xyzList = new ArrayList&lt;&gt;();
  
  ............................
  do some things with the list
  ............................
  
  if (xyzList != null &amp;&amp; xyzList.size() &gt; 0) doSomething();
  </code></pre>
  
  <p>Is there any case where a list can be null but have a size greater than 0? Or is this redundant and equivalent to <code>if (xyzList.size() &gt; 0)</code>?</p>
  
  <p>EDIT: xyzList can be modified from an outside class, so the null check is definitely needed. Thanks for responses, I've just had a long day and my mind was not functioning.</p>