queue java poll code example
Example: 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]
//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]