March 2005
Beginner to intermediate
1254 pages
104h 21m
English
ConcurrentLinkedQueue<E>
This
class
is a threadsafe implementation of the
java.util.Queue interface (but not of the
BlockingQueue interface). It provides threadsafety
without using synchronized methods that would lock
the entire data structure. ConcurrentLinkedQueue
is unbounded and orders its elements on a first-in, first-out (FIFO)
basis. null elements are not allowed. This
implementation uses a linked-list data structure internally. Note
that the size( ) method must traverse the internal
data structure and is therefore a relatively expensive operation for
this class.

Figure 16-76. java.util.concurrent.ConcurrentLinkedQueue<E>
public class ConcurrentLinkedQueue<E> extends java.util.AbstractQueue<E> implements java.util.Queue<E>, Serializable { // Public Constructors public ConcurrentLinkedQueue( ); public ConcurrentLinkedQueue(java.util.Collection<? extends E> c); // Methods Implementing Collection public boolean add(E o); public boolean contains(Object o); public boolean isEmpty( ); default:true public java.util.Iterator<E> iterator( ); public boolean remove(Object o); public int size( ); public Object[ ] toArray( ); public <T> T[ ] toArray(T[ ] a); // Methods Implementing Queue public boolean offer(E o); public E peek( ); public E poll( ); }
Read now
Unlock full access