ElementType
- contained element typepublic class LimitedQueue<ElementType> extends Object implements BlockingQueue<ElementType>
Constructor and Description |
---|
LimitedQueue(int capacity)
Creates a queue with the specified capacity.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(ElementType e) |
boolean |
addAll(Collection<? extends ElementType> c) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
int |
drainTo(Collection<? super ElementType> c) |
int |
drainTo(Collection<? super ElementType> c,
int maxElements) |
ElementType |
element() |
protected BlockingQueue<ElementType> |
getQueue()
Returns the underlying queue.
|
boolean |
isEmpty() |
Iterator<ElementType> |
iterator() |
boolean |
offer(ElementType e) |
boolean |
offer(ElementType e,
long timeout,
TimeUnit unit) |
ElementType |
peek() |
ElementType |
poll() |
ElementType |
poll(long timeout,
TimeUnit unit) |
void |
put(ElementType e) |
int |
remainingCapacity() |
ElementType |
remove() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
ElementType |
take() |
Object[] |
toArray() |
<TargetType> |
toArray(TargetType[] a) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, hashCode
public LimitedQueue(int capacity)
capacity
- capacity of the queueprotected BlockingQueue<ElementType> getQueue()
public ElementType remove()
remove
in interface Queue<ElementType>
public ElementType poll()
poll
in interface Queue<ElementType>
public ElementType element()
element
in interface Queue<ElementType>
public ElementType peek()
peek
in interface Queue<ElementType>
public int size()
size
in interface Collection<ElementType>
public boolean isEmpty()
isEmpty
in interface Collection<ElementType>
public Iterator<ElementType> iterator()
iterator
in interface Iterable<ElementType>
iterator
in interface Collection<ElementType>
public Object[] toArray()
toArray
in interface Collection<ElementType>
public <TargetType> TargetType[] toArray(TargetType[] a)
toArray
in interface Collection<ElementType>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<ElementType>
public boolean addAll(Collection<? extends ElementType> c)
addAll
in interface Collection<ElementType>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<ElementType>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<ElementType>
public void clear()
clear
in interface Collection<ElementType>
public boolean add(ElementType e)
add
in interface Collection<ElementType>
add
in interface BlockingQueue<ElementType>
add
in interface Queue<ElementType>
public boolean offer(ElementType e)
offer
in interface BlockingQueue<ElementType>
offer
in interface Queue<ElementType>
public void put(ElementType e) throws InterruptedException
put
in interface BlockingQueue<ElementType>
InterruptedException
public boolean offer(ElementType e, long timeout, TimeUnit unit) throws InterruptedException
offer
in interface BlockingQueue<ElementType>
InterruptedException
public ElementType take() throws InterruptedException
take
in interface BlockingQueue<ElementType>
InterruptedException
public ElementType poll(long timeout, TimeUnit unit) throws InterruptedException
poll
in interface BlockingQueue<ElementType>
InterruptedException
public int remainingCapacity()
remainingCapacity
in interface BlockingQueue<ElementType>
public boolean remove(Object o)
remove
in interface Collection<ElementType>
remove
in interface BlockingQueue<ElementType>
public boolean contains(Object o)
contains
in interface Collection<ElementType>
contains
in interface BlockingQueue<ElementType>
public int drainTo(Collection<? super ElementType> c)
drainTo
in interface BlockingQueue<ElementType>
public int drainTo(Collection<? super ElementType> c, int maxElements)
drainTo
in interface BlockingQueue<ElementType>
Copyright © 2018 CoR-Lab. All rights reserved.