This kind of collection provides advanced operations compared to basic
collections, such as insertion, extraction, and inspection.
Generally, a queue orders its elements by means of first-in-first-out.
However, a priority queue orders its elements according to a comparator
specified or the elements' natural order. Furthermore, a stack orders its
elements last-in-first out.
A typical queue does not allow {@code null} to be inserted as its element,
while some implementations such as {@code LinkedList} allow it. But {@code
null} should not be inserted even in these implementations, since the method
{@code poll} returns {@code null} to indicate that there is no element left
in the queue.
{@code Queue} does not provide blocking queue methods, which would block
until the operation of the method is allowed. See the
{@link java.util.concurrent.BlockingQueue} interface for information about
blocking queue methods.
|