Package com.google.common.collect
Class ForwardingBlockingDeque<E>
- java.lang.Object
-
- com.google.common.collect.ForwardingObject
-
- com.google.common.collect.ForwardingCollection<E>
-
- com.google.common.collect.ForwardingQueue<E>
-
- com.google.common.collect.ForwardingDeque<E>
-
- com.google.common.collect.ForwardingBlockingDeque<E>
-
- All Implemented Interfaces:
Iterable<E>,Collection<E>,BlockingDeque<E>,BlockingQueue<E>,Deque<E>,Queue<E>
public abstract class ForwardingBlockingDeque<E> extends ForwardingDeque<E> implements BlockingDeque<E>
ABlockingDequewhich forwards all its method calls to anotherBlockingDeque. Subclasses should override one or more methods to modify the behavior of the backing deque as desired per the decorator pattern.Warning: The methods of
ForwardingBlockingDequeforward indiscriminately to the methods of the delegate. For example, overridingForwardingCollection.add(E)alone will not change the behaviour ofoffer(E, long, java.util.concurrent.TimeUnit)which can lead to unexpected behaviour. In this case, you should overrideofferas well, either providing your own implementation, or delegating to the providedstandardOffermethod.The
standardmethods are not guaranteed to be thread-safe, even when all of the methods that they depend on are thread-safe.- Since:
- 14.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdrainTo(Collection<? super E> c)intdrainTo(Collection<? super E> c, int maxElements)booleanoffer(E e, long timeout, TimeUnit unit)booleanofferFirst(E e, long timeout, TimeUnit unit)booleanofferLast(E e, long timeout, TimeUnit unit)Epoll(long timeout, TimeUnit unit)EpollFirst(long timeout, TimeUnit unit)EpollLast(long timeout, TimeUnit unit)voidput(E e)voidputFirst(E e)voidputLast(E e)intremainingCapacity()Etake()EtakeFirst()EtakeLast()-
Methods inherited from class com.google.common.collect.ForwardingDeque
addFirst, addLast, descendingIterator, getFirst, getLast, offerFirst, offerLast, peekFirst, peekLast, pollFirst, pollLast, pop, push, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence
-
Methods inherited from class com.google.common.collect.ForwardingQueue
element, offer, peek, poll, remove
-
Methods inherited from class com.google.common.collect.ForwardingCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
-
Methods inherited from class com.google.common.collect.ForwardingObject
toString
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.concurrent.BlockingDeque
add, addFirst, addLast, contains, element, iterator, offer, offerFirst, offerLast, peek, poll, push, remove, remove, removeFirstOccurrence, removeLastOccurrence, size
-
Methods inherited from interface java.util.Collection
clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
-
-
-
Method Detail
-
remainingCapacity
public int remainingCapacity()
- Specified by:
remainingCapacityin interfaceBlockingQueue<E>
-
putFirst
public void putFirst(E e) throws InterruptedException
- Specified by:
putFirstin interfaceBlockingDeque<E>- Throws:
InterruptedException
-
putLast
public void putLast(E e) throws InterruptedException
- Specified by:
putLastin interfaceBlockingDeque<E>- Throws:
InterruptedException
-
offerFirst
public boolean offerFirst(E e, long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
offerFirstin interfaceBlockingDeque<E>- Throws:
InterruptedException
-
offerLast
public boolean offerLast(E e, long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
offerLastin interfaceBlockingDeque<E>- Throws:
InterruptedException
-
takeFirst
public E takeFirst() throws InterruptedException
- Specified by:
takeFirstin interfaceBlockingDeque<E>- Throws:
InterruptedException
-
takeLast
public E takeLast() throws InterruptedException
- Specified by:
takeLastin interfaceBlockingDeque<E>- Throws:
InterruptedException
-
pollFirst
public E pollFirst(long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
pollFirstin interfaceBlockingDeque<E>- Throws:
InterruptedException
-
pollLast
public E pollLast(long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
pollLastin interfaceBlockingDeque<E>- Throws:
InterruptedException
-
put
public void put(E e) throws InterruptedException
- Specified by:
putin interfaceBlockingDeque<E>- Specified by:
putin interfaceBlockingQueue<E>- Throws:
InterruptedException
-
offer
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
offerin interfaceBlockingDeque<E>- Specified by:
offerin interfaceBlockingQueue<E>- Throws:
InterruptedException
-
take
public E take() throws InterruptedException
- Specified by:
takein interfaceBlockingDeque<E>- Specified by:
takein interfaceBlockingQueue<E>- Throws:
InterruptedException
-
poll
public E poll(long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
pollin interfaceBlockingDeque<E>- Specified by:
pollin interfaceBlockingQueue<E>- Throws:
InterruptedException
-
drainTo
public int drainTo(Collection<? super E> c)
- Specified by:
drainToin interfaceBlockingQueue<E>
-
drainTo
public int drainTo(Collection<? super E> c, int maxElements)
- Specified by:
drainToin interfaceBlockingQueue<E>
-
-