Java Queue class
java.util
Interface Queue<E>
Type
Parameters:
E - the type of
elements held in this collection
All
Superinterfaces:
Collection<E>, Iterable<E>
All Known
Subinterfaces:
All Known
Implementing Classes:
AbstractQueue, ArrayBlockingQueue, ConcurrentLinkedQueue, DelayQueue, LinkedBlockingQueue, LinkedList,
PriorityBlockingQueue, PriorityQueue, SynchronousQueue
public interface Queue<E>
extends Collection<E>
A collection designed for holding
elements prior to processing. Besides basic Collection operations, queues provide additional
insertion, extraction, and inspection operations.
Queues
typically, but do not necessarily, order elements in a FIFO
(first-in-first-out) manner. Among the exceptions are
priority queues, which order elements according to a supplied comparator, or
the elements' natural ordering, and LIFO queues (or stacks) which order the
elements LIFO (last-in-first-out). Whatever the
ordering used, the head of the queue is that element which would be
removed by a call to remove()
or poll()
. In a FIFO queue, all new elements are inserted at the tail
of the queue. Other kinds of queues may use different
placement rules. Every Queue implementation must specify its ordering
properties
element() |
|
boolean |
offer(E o) |
peek() |
|
poll() |
|
remove() |