Assignment #1 testPrintJobsNoResults

Hi guys,
Under the section for the printJobs method, the instructions say “If there are no results, it should print ‘No Results’”.
I’m having trouble understanding how to code this. To explain, this is how I’ve been thinking about it: The printJobs method is used in the main for BOTH the list and search options, but “No Results” only applies to the search option. So if I use a conditional if in the printJobs method, i.e.
Scanner input = new Scanner(;
String userInput =;
if (someJobs.contains(userInput)) {
// for loops to iterate over someJobs
} else {
Scanner.out.println(“No Results”);
This won’t work because userInput is irrelevant for the list option.
Does anyone know if we should change the code under the else statement (the “search” option) in the main, instead of trying to get “No Results” to work in printJobs?
The rest of the assignment is working and passes the tests (the instructions were super clear which was great) but I’m stuck on conceptualizing this one so any advice would be super appreciated.
Thanks guys!

I checked to see if someJobs was empty first, then printed no results if that was true. My else statement was the loops to print jobs if there were any. No need to change code elsewhere.

1 Like