020-004-007
Using LinkedList as a Queue
Easy
Problem Description
Using LinkedList as a Queue
In this problem, you will create a method that takes three task names as arguments, uses LinkedList as a Queue to process them in FIFO order, and returns the results as a string.
Learning Objective: Understand basic Queue interface operations (add, peek, poll)
Overview
Create a method that uses LinkedList as a Queue to process tasks in FIFO (first-in, first-out) order.
Specifications
- Implement
processQueue(String task1, String task2, String task3)method - Add the three argument tasks to a
Queue<String>in order - Return the queue size,
peek()result, and allpoll()results joined by newlines
Input/Output Example
processQueue("Task A", "Task B", "Task C")
→ "Size: 3\nPeek: Task A\nProcessing: Task A\nProcessing: Task B\nProcessing: Task C"
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up