public class LockFreeQueue<T>
extends java.lang.Object
ConcurrentLinkedQueue
that exhibits a subset of the available methods,
and keeps track in an AtomicLong
of the size of the queue,
so that size()
can return in constant time.Constructor | Description |
---|---|
LockFreeQueue() |
Modifier and Type | Method | Description |
---|---|---|
boolean |
add(T e) |
|
boolean |
equals(java.lang.Object o) |
|
int |
hashCode() |
|
T |
poll() |
|
long |
size() |
Returns the (approximate) size of this queue.
|
public boolean add(T e)
Queue.add(Object)
public T poll()
Queue.poll()
public long size()
This methods returns in constant time (it is just an AtomicLong.get()
).
Due to concurrent modifications, the returned value might not reflect the actual number of elements in the queue.
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object