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

  1. Implement processQueue(String task1, String task2, String task3) method
  2. Add the three argument tasks to a Queue<String> in order
  3. Return the queue size, peek() result, and all poll() 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