While a queue has work
A while loop repeats as long as its test is true.
Your task
Work through a queue of tasks from the front until it is empty, then show that an empty queue does no work.
List<String> workQueue = new List<String>{ 'Validate', 'Enrich', 'Route' };
Integer processedCount = 0;
List<String> emptyQueue = new List<String>();
Integer emptyProcessed = 0;Requirements
Processing: Validateand the other two lines should be printed in orderProcessed count: 3should be printedRemaining work: 0should be printedEmpty processed: 0should be printed- while loop should be used that runs while
workQueueis not empty workQueue.remove(0)should be called inside the loopProcessing: Validateshould be built at runtime