Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Java Data Structures!
You have completed Java Data Structures!
Preview
Let's explore the `java.util.Queue` interface and learn how to poll for the next item to be processed.
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
And that is the queue interface.
0:00
Queues are used when you want to store
elements prior to processing.
0:02
They provide convenient methods
0:06
for grabbing the next element
and removing it from the list.
0:07
This is called polling.
0:11
By default, queues
work in FIFO, first in, first out.
0:13
I put stuff in the queue that I want
something else to process when it's ready.
0:17
And that program does so
by calling the pull method on the queue.
0:21
If there is an element,
it gets removed and returned.
0:25
If not, it returns a null.
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up