title: How check if the lists in a list are not empty?
body: <p>I have a list of lists in Java. Here is the code:</p>
  
  <pre><code>List&lt;List&lt;Integer&gt;&gt; myList = new ArrayList&lt;&gt;();
  myList.add(new ArrayList&lt;Integer&gt;());
  myList.add(new ArrayList&lt;Integer&gt;());
  myList.add(new ArrayList&lt;Integer&gt;());
  
  myList.get(0).add(1);
  myList.get(0).add(2);
  myList.get(0).add(3);
  myList.get(1).add(4);
  myList.get(1).add(5);
  myList.get(1).add(6);
  myList.get(2).add(7);
  myList.get(2).add(8);
  myList.get(2).add(9);
  </code></pre>
  
  <p>Now in a part of my code I want to check if all three lists that are located in <code>myList</code> are not empty and null. Should I check each of these lists one by one, like this:</p>
  
  <pre><code>if (myList.get(0) != null &amp;&amp; !myList.get(0).isEmpty()) { 
      // do something
  } 
  </code></pre>
  
  <p>...or is there a better and shorter way to do instead of checking one by one?</p>