FileDocCategorySizeDatePackage
Queue.javaAPI DocAndroid 1.5 API3767Wed May 06 22:41:04 BST 2009java.util

Queue

public interface Queue implements Collection
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.

since
Android 1.0

Fields Summary
Constructors Summary
Methods Summary
public Eelement()
Gets but does not remove the element at the head of the queue. Throws a {@code NoSuchElementException} if there is no element in the queue.

return
the element at the head of the queue.
throws
NoSuchElementException if there is no element in the queue.
since
Android 1.0

public booleanoffer(E o)
Inserts the specified element into the queue provided that the condition allows such an operation. The method is generally preferable to {@link Collection#add}, since the latter might throw an exception if the operation fails.

param
o the specified element to insert into the queue.
return
{@code true} if the operation succeeds and {@code false} if it fails.
since
Android 1.0

public Epeek()
Gets but does not remove the element at the head of the queue.

return
the element at the head of the queue or {@code null} if there is no element in the queue.
since
Android 1.0

public Epoll()
Gets and removes the element at the head of the queue, or returns {@code null} if there is no element in the queue.

return
the element at the head of the queue or {@code null} if there is no element in the queue.
since
Android 1.0

public Eremove()
Gets and removes the element at the head of the queue. Throws a NoSuchElementException if there is no element in the queue.

return
the element at the head of the queue.
throws
NoSuchElementException if there is no element in the queue.
since
Android 1.0