Check out example codes for "queue.poll() in java". It will help you in understanding the concepts better.

Code Example 1

//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]

Learn ReactJs, React Native from akashmittal.com