E - The element type of the queue.public class LifoBlockingDeque<E> extends LinkedBlockingDeque<E>
LinkedBlockingDeque of which the non ordered element addition methods add elements at the start of the
queue rather than the end. When used as a Queue this will result in a LIFO (last in first out) queue.
Note: that this means it breaks the contract of Deque.
| Constructor and Description |
|---|
LifoBlockingDeque() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e)
Add an element to the start of the queue.
|
boolean |
offer(E e)
Add an element to the start of the queue, if there is space, without blocking.
|
boolean |
offer(E e,
long timeout,
TimeUnit unit)
Add an element to the start of the queue, if there is space, waiting for the specified amount of time if
necessary for space to become available.
|
void |
put(E e)
Add an element to the start of the queue, waiting indefinitely for space to become available if necessary.
|
addFirst, addLast, clear, contains, descendingIterator, drainTo, drainTo, element, getFirst, getLast, iterator, offerFirst, offerFirst, offerLast, offerLast, peek, peekFirst, peekLast, poll, poll, pollFirst, pollFirst, pollLast, pollLast, pop, push, putFirst, putLast, remainingCapacity, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, size, spliterator, take, takeFirst, takeLast, toArray, toArray, toStringaddAllcontainsAll, isEmpty, removeAll, retainAllclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddAll, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, streampublic boolean add(E e)
add in interface Collection<E>add in interface BlockingDeque<E>add in interface BlockingQueue<E>add in interface Deque<E>add in interface Queue<E>add in class LinkedBlockingDeque<E>e - The element to add.trueIllegalStateException - If there is no space on the queue.public boolean offer(E e)
offer in interface BlockingDeque<E>offer in interface BlockingQueue<E>offer in interface Deque<E>offer in interface Queue<E>offer in class LinkedBlockingDeque<E>e - The element to add.true if the element was added or false if there was no space.public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException
offer in interface BlockingDeque<E>offer in interface BlockingQueue<E>offer in class LinkedBlockingDeque<E>e - The element to add.timeout - The maximum amount of time to wait for space to become available.unit - The unit of timeout.true if the element was added or false if there was no space after waiting the specified
amount of time.InterruptedException - If the thread was interrupted while waiting for space to become available.public void put(E e) throws InterruptedException
put in interface BlockingDeque<E>put in interface BlockingQueue<E>put in class LinkedBlockingDeque<E>e - The element to add.InterruptedException - If the thread was interrupted while waiting for space to become available.Copyright © 2011–2023 pepsoft.org. All rights reserved.