queue hasNext java code example
Example: 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);
}