public class WeightedQueue<T>
extends java.lang.Object
implements java.util.concurrent.BlockingQueue<T>
Modifier and Type | Class and Description |
---|---|
static interface |
WeightedQueue.Weighable |
static interface |
WeightedQueue.Weigher<T> |
Modifier and Type | Field and Description |
---|---|
static WeightedQueue.Weigher |
NATURAL_WEIGHER |
Constructor and Description |
---|
WeightedQueue(int maxWeight) |
WeightedQueue(int maxWeight,
java.util.concurrent.BlockingQueue<T> queue,
WeightedQueue.Weigher<T> weigher) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(T e) |
boolean |
addAll(java.util.Collection<? extends T> c) |
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
int |
drainTo(java.util.Collection<? super T> c) |
int |
drainTo(java.util.Collection<? super T> c,
int maxElements) |
T |
element() |
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator() |
boolean |
offer(T t) |
boolean |
offer(T t,
long timeout,
java.util.concurrent.TimeUnit unit) |
T |
peek() |
T |
poll() |
T |
poll(long timeout,
java.util.concurrent.TimeUnit unit) |
void |
put(T t) |
int |
remainingCapacity() |
T |
remove() |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
T |
take() |
java.lang.Object[] |
toArray() |
<T1> T1[] |
toArray(T1[] a) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final WeightedQueue.Weigher NATURAL_WEIGHER
public WeightedQueue(int maxWeight)
public WeightedQueue(int maxWeight, java.util.concurrent.BlockingQueue<T> queue, WeightedQueue.Weigher<T> weigher)
public boolean add(T e)
public boolean offer(T t)
public void put(T t) throws java.lang.InterruptedException
put
in interface java.util.concurrent.BlockingQueue<T>
java.lang.InterruptedException
public boolean offer(T t, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
offer
in interface java.util.concurrent.BlockingQueue<T>
java.lang.InterruptedException
public T take() throws java.lang.InterruptedException
take
in interface java.util.concurrent.BlockingQueue<T>
java.lang.InterruptedException
public T poll(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
poll
in interface java.util.concurrent.BlockingQueue<T>
java.lang.InterruptedException
public int remainingCapacity()
remainingCapacity
in interface java.util.concurrent.BlockingQueue<T>
public boolean remove(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> c)
containsAll
in interface java.util.Collection<T>
public boolean addAll(java.util.Collection<? extends T> c)
addAll
in interface java.util.Collection<T>
public boolean removeAll(java.util.Collection<?> c)
removeAll
in interface java.util.Collection<T>
public boolean retainAll(java.util.Collection<?> c)
retainAll
in interface java.util.Collection<T>
public void clear()
clear
in interface java.util.Collection<T>
public int size()
size
in interface java.util.Collection<T>
public boolean isEmpty()
isEmpty
in interface java.util.Collection<T>
public boolean contains(java.lang.Object o)
public java.util.Iterator<T> iterator()
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<T>
public <T1> T1[] toArray(T1[] a)
toArray
in interface java.util.Collection<T>
public int drainTo(java.util.Collection<? super T> c)
drainTo
in interface java.util.concurrent.BlockingQueue<T>
Copyright © 2009-2022 The Apache Software Foundation