title: How to throw an error and return an empty list at the same time?
body: <p>I am working on a homework right now and I am asked to return an empty list and print an error message if the field is empty. </p>
  
  <p>This is my code so far, however either the throw error or return empty list (the later one if I change the order) is unreachable. How am I supposed to do that? </p>
  
  <pre><code>// the method is not void it returns a list
    if (fileContent.equals(null)) {
              return Collections.emptyList();
              throw new Error("ERROR: No content loaded before parsing.");
          } else {
              // return another list ;
  }
  </code></pre>
  
  <p>And this is the error that I have been getting: </p>
  
  <pre><code>org.junit.ComparisonFailure: Console output not as expected in parseFileContent. 
  Expected :ERROR: No content loaded before parsing.
  Actual   :ERROR: executing parseFileContent for console output check:java.lang.NullPointerException
  </code></pre>
  
  <p>Thanks!</p>