public class ResizeableLinkedBlockingDeque<T>
extends java.lang.Object
implements java.util.concurrent.BlockingDeque<T>
Constructor and Description |
---|
ResizeableLinkedBlockingDeque()
Creates an unbounded deque
|
ResizeableLinkedBlockingDeque(int capacity)
Creates a deque with the specified capacity
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(T t) |
boolean |
addAll(java.util.Collection<? extends T> collection) |
void |
addFirst(T t) |
void |
addFirstForce(T t)
Adds the given element to the beginning of the dequeue regardless of capacity restrictions
|
void |
addLast(T t) |
void |
addLastForce(T t)
Adds the given element to the end of the dequeue regardless of capacity restrictions
|
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> collection) |
java.util.Iterator<T> |
descendingIterator() |
int |
drainTo(java.util.Collection<? super T> collection) |
int |
drainTo(java.util.Collection<? super T> collection,
int maxElements) |
T |
element() |
int |
getCapacity()
Returns the Capacity for the object
|
T |
getFirst() |
T |
getLast() |
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator() |
boolean |
offer(T t) |
boolean |
offer(T t,
long timeout,
java.util.concurrent.TimeUnit unit) |
boolean |
offerFirst(T t) |
boolean |
offerFirst(T t,
long timeout,
java.util.concurrent.TimeUnit unit) |
boolean |
offerLast(T t) |
boolean |
offerLast(T t,
long timeout,
java.util.concurrent.TimeUnit unit) |
T |
peek() |
T |
peekFirst() |
T |
peekLast() |
T |
poll() |
T |
poll(long timeout,
java.util.concurrent.TimeUnit unit) |
T |
pollFirst() |
T |
pollFirst(long timeout,
java.util.concurrent.TimeUnit unit) |
T |
pollLast() |
T |
pollLast(long timeout,
java.util.concurrent.TimeUnit unit) |
T |
pop() |
void |
push(T t) |
void |
put(T t) |
void |
putFirst(T t) |
void |
putLast(T t) |
int |
remainingCapacity() |
T |
remove() |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> collection) |
T |
removeFirst() |
boolean |
removeFirstOccurrence(java.lang.Object o) |
T |
removeLast() |
boolean |
removeLastOccurrence(java.lang.Object o) |
boolean |
retainAll(java.util.Collection<?> collection) |
void |
setCapacity(int capacity)
Sets the Capacity for the object
|
int |
size() |
T |
take() |
T |
takeFirst() |
T |
takeLast() |
java.lang.Object[] |
toArray() |
<U> U[] |
toArray(U[] writeArray) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public ResizeableLinkedBlockingDeque()
public ResizeableLinkedBlockingDeque(int capacity)
capacity
- The capacity of the deque (negative means infinite). Must not be 0public int getCapacity()
public void setCapacity(int capacity)
capacity
- The new value for Capacity (negative for infinite, must be non-zero)public void addFirst(@NotNull T t)
public void addLast(@NotNull T t)
public boolean offerFirst(@NotNull T t)
public boolean offerLast(@NotNull T t)
@NotNull public T removeFirst()
removeFirst
in interface java.util.Deque<T>
public void putFirst(T t) throws java.lang.InterruptedException
putFirst
in interface java.util.concurrent.BlockingDeque<T>
java.lang.InterruptedException
public void putLast(T t) throws java.lang.InterruptedException
putLast
in interface java.util.concurrent.BlockingDeque<T>
java.lang.InterruptedException
public void addFirstForce(T t)
t
- The element to addpublic void addLastForce(T t)
t
- The element to addpublic boolean offerFirst(T t, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
offerFirst
in interface java.util.concurrent.BlockingDeque<T>
java.lang.InterruptedException
public boolean offerLast(T t, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
offerLast
in interface java.util.concurrent.BlockingDeque<T>
java.lang.InterruptedException
@NotNull public T takeFirst() throws java.lang.InterruptedException
takeFirst
in interface java.util.concurrent.BlockingDeque<T>
java.lang.InterruptedException
@NotNull public T takeLast() throws java.lang.InterruptedException
takeLast
in interface java.util.concurrent.BlockingDeque<T>
java.lang.InterruptedException
@Nullable public T pollFirst(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
pollFirst
in interface java.util.concurrent.BlockingDeque<T>
java.lang.InterruptedException
@Nullable public T pollLast(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
pollLast
in interface java.util.concurrent.BlockingDeque<T>
java.lang.InterruptedException
public boolean removeFirstOccurrence(@Nullable java.lang.Object o)
public boolean removeLastOccurrence(@Nullable java.lang.Object o)
public boolean add(T t)
public boolean offer(T t)
public void put(T t) throws java.lang.InterruptedException
public boolean offer(T t, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
@NotNull public T remove()
@Nullable public T poll()
@NotNull public T take() throws java.lang.InterruptedException
@Nullable public T poll(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
public int remainingCapacity()
remainingCapacity
in interface java.util.concurrent.BlockingQueue<T>
@NotNull public T element()
@Nullable public T peek()
public boolean remove(@Nullable java.lang.Object o)
public boolean containsAll(@NotNull java.util.Collection<?> collection)
containsAll
in interface java.util.Collection<T>
public boolean addAll(@NotNull java.util.Collection<? extends T> collection)
addAll
in interface java.util.Collection<T>
public boolean removeAll(@NotNull java.util.Collection<?> collection)
removeAll
in interface java.util.Collection<T>
public boolean retainAll(@NotNull java.util.Collection<?> collection)
retainAll
in interface java.util.Collection<T>
public void clear()
clear
in interface java.util.Collection<T>
public boolean contains(java.lang.Object o)
public int drainTo(@NotNull java.util.Collection<? super T> collection)
drainTo
in interface java.util.concurrent.BlockingQueue<T>
public int drainTo(@NotNull java.util.Collection<? super T> collection, int maxElements)
drainTo
in interface java.util.concurrent.BlockingQueue<T>
public int size()
public boolean isEmpty()
isEmpty
in interface java.util.Collection<T>
@NotNull public java.util.Iterator<T> iterator()
@NotNull public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<T>
@NotNull public <U> U[] toArray(@NotNull U[] writeArray)
toArray
in interface java.util.Collection<T>
@NotNull public java.util.Iterator<T> descendingIterator()
descendingIterator
in interface java.util.Deque<T>
public void push(T t)