Your task is to implement the TaskProcessorServiceImpl
class,
which will have only one method - processTasks()
.
This method should process all tasks from the passed taskQueueService
queue.
Use the methods of this interface to achieve the result.
Instructions:
- First, you should use composition and create an instance of the
TaskQueue
class. Then, also add its initialization in the constructor. - Next, implement the
TaskProcessorImpl
interface and override its methods. - In the implementation of the interface, use a
while
loop with theisEmpty()
method as the condition. - Inside the
while
loop, use thetaskQueueService.getNextTask()
method, indicating that the task is completed. Output information to the screen usingSystem.out.println()
- "Processing Task: " + task. - When the loop finishes its work, output "All tasks processed." to the screen.
- Run the tests and check the correctness of your solution.