title: Avoiding Null Pointer Exception in "for" statement
body: <p>In my code I usually use this approach to avoid <code>NullPointerException</code>s in for statements when a <code>List</code> is null:</p>
  
  <pre><code>if (myList != null &amp;&amp; myList.size() &gt; 0) {
      for ( MyObj obj : myList ) {
          System.out.println("MyObjStr: "+obj);
      }
  }
  </code></pre>
  
  <p>Is there another way to do the same without write the "if" statement, but using the same "for" statement?</p>