LinkedBlockingDeque
Jakob Jenkov |
The LinkedBlockingDeque class implements the BlockingDeque interface.
Read the BlockingDeque text for more information about the interface.
The word Deque comes from the term "Double Ended Queue". A Deque is thus a queue where
you can insert and remove elements from both ends of the queue.
The LinkedBlockingDeque is a Deque which will block if a thread attempts to take
elements out of it while it is empty, regardless of what end the thread is attempting to take elements from.
Here is how to instantiate and use a LinkedBlockingDeque:
BlockingDeque<String> deque = new LinkedBlockingDeque<String>();
deque.addFirst("1");
deque.addLast("2");
String two = deque.takeLast();
String one = deque.takeFirst();
Next: Java ConcurrentMap
| Tweet | |
Jakob Jenkov | |











