title: Null safe concatenation of two nullable list of items
body: <p>I'm trying to add two nullable list using below:</p>
  <pre><code>List&lt;Employee&gt; employees = null;
  if (&lt;some condition&gt;) {
      employees = employeeService.getEmployees(&lt;some criteria&gt;);
  
      // Add another list of employees
      if (&lt;some condition&gt;) {
          List&lt;Employee&gt; employeesSubList = employeeService.getEmployees(&lt;some other criteria&gt;));
          if (!isEmpty(employeesSubList)) {
              if (!isEmpty(employees)) {
                  employees.addAll(employeesSubList);
              } else {
                  employees = employeesSubList;
              }
          }
      }
  }
  </code></pre>
  <p>This works but the code looks horribly ugly. There is a hard condition that the parent <code>List&lt;Employee&gt; employees</code> will be null instead of empty list in case no employees are present.
  Is there a cleaner way to do the same?</p>
  <p>I tried Java 8 approach but IntelliJ throws some warnings on <code>.orElse(emptyList()).addAll(employeesSubList)</code>:</p>
  <pre><code>List&lt;Employee&gt; employees = null;
  if (&lt;some condition&gt;) {
      employees = employeeService.getEmployees(&lt;some criteria&gt;);
  
      // Add another list of employees
      if (&lt;some condition&gt;) {
          List&lt;Employee&gt; employeesSubList = employeeService.getEmployees(&lt;some other criteria&gt;));
          if (!isEmpty(employeesSubList)) {
              Optional.ofNullable(employees).orElse(emptyList()).addAll(employeesSubList);
          }
      }
  }
  </code></pre>