poll java queue code example
Example 1: queue.poll() in java
//prints the head and deletes the head.
q=[10,20,30]
int n=q.poll();//returns 10 q=[20,30]
int m=q.poll();//returns 20 q=[30]
Example 2: queue.isempty java
while (!QUEUE.isEmpty()) {
QUEUE.remove();
}