title: Checking if the optional list is valid in java
body: <p>Let's say I have a list of users. <code>List&lt;User&gt; users</code>;</p>
  
  <pre><code>class User{
   private String userId;
   //getters setters.
  }
  </code></pre>
  
  <p>I wanted to check, whether the list is valid or not. List is not valid if below condition is matched.</p>
  
  <ol>
  <li>It's empty
  OR</li>
  <li>If User in each of the list items have userId value.</li>
  </ol>
  
  <p>How can I do that using <code>java.utils.Optional</code> in a cleaner way?</p>