Answers for "how to iterate a queue in java"

0

how to iterate a queue in java

Queue<Integer> queue = new LinkedList<Integer>();
        queue.add(1);
        queue.add(2);
        queue.add(3);
 
        for (Integer item: queue) {
            System.out.println(item);
        }
Posted by: Guest on January-21-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language