title: Java return an empty list
body: <p>I have my Java method as below;</p>
  
  <pre><code>public List&lt;Lookup&gt; findAll(String lang) {
      Query query = entityManager.createNamedQuery("Lookup.findAll");
      if (isValidLang(lang)) {
          query.setParameter("lang", lang);
          return query.getResultList();
      } else {
          //return empty list
      }
  }
  </code></pre>
  
  <p>Now the method returns List for valid matches of lang.</p>
  
  <p>But if that is not the case, I want to return an empty list. My question is how do I update the code &amp; what is the best way to return an empty list so that the code does not fail ?</p>