Java.Util.Concurrent.IBlockingDeque
A Java.Util.IDeque that additionally supports blocking operations that wait for the deque to become non-empty when retrieving an element, and wait for space to become available in the deque when storing an element.

See Also: IBlockingDeque Members

Syntax

[Android.Runtime.Register("java/util/concurrent/BlockingDeque", "", "Java.Util.Concurrent.IBlockingDequeInvoker")]
public interface IBlockingDeque : IBlockingQueue, Java.Util.IDeque, IDisposable

Remarks

A Java.Util.IDeque that additionally supports blocking operations that wait for the deque to become non-empty when retrieving an element, and wait for space to become available in the deque when storing an element.

BlockingDeque methods come in four forms, with different ways of handling operations that cannot be satisfied immediately, but may be satisfied at some point in the future: one throws an exception, the second returns a special value (either null or false, depending on the operation), the third blocks the current thread indefinitely until the operation can succeed, and the fourth blocks for only a given maximum time limit before giving up. These methods are summarized in the following table:

First Element (Head)
Throws exceptionSpecial valueBlocksTimes out
InsertIBlockingDeque.addFirst(E)IBlockingDeque.offerFirst(E)IBlockingDeque.putFirst(E)IBlockingDeque.offerFirst(E, long, java.util.concurrent.TimeUnit)
RemoveJava.Util.IDeque.RemoveFirstJava.Util.IDeque.PollFirstIBlockingDeque.TakeFirstIBlockingDeque.PollFirst(long, Java.Util.Concurrent.TimeUnit)
ExamineJava.Util.IDeque.FirstJava.Util.IDeque.PeekFirstnot applicablenot applicable
Last Element (Tail)
Throws exceptionSpecial valueBlocksTimes out
InsertIBlockingDeque.addLast(E)IBlockingDeque.offerLast(E)IBlockingDeque.putLast(E)IBlockingDeque.offerLast(E, long, java.util.concurrent.TimeUnit)
RemoveJava.Util.IDeque.RemoveLastJava.Util.IDeque.PollLastIBlockingDeque.TakeLastIBlockingDeque.PollLast(long, Java.Util.Concurrent.TimeUnit)
ExamineJava.Util.IDeque.LastJava.Util.IDeque.PeekLastnot applicablenot applicable

Like any Java.Util.Concurrent.IBlockingQueue, a BlockingDeque is thread safe, does not permit null elements, and may (or may not) be capacity-constrained.

A BlockingDeque implementation may be used directly as a FIFO BlockingQueue. The methods inherited from the BlockingQueue interface are precisely equivalent to BlockingDeque methods as indicated in the following table:

BlockingQueue MethodEquivalent BlockingDeque Method
Insert
IBlockingDeque.add(E)IBlockingDeque.addLast(E)
IBlockingDeque.offer(E)IBlockingDeque.offerLast(E)
IBlockingDeque.put(E)IBlockingDeque.putLast(E)
IBlockingDeque.offer(E, long, java.util.concurrent.TimeUnit)IBlockingDeque.offerLast(E, long, java.util.concurrent.TimeUnit)
Remove
IBlockingDeque.RemoveJava.Util.IDeque.RemoveFirst
IBlockingDeque.PollJava.Util.IDeque.PollFirst
IBlockingDeque.TakeIBlockingDeque.TakeFirst
IBlockingDeque.Poll(long, Java.Util.Concurrent.TimeUnit)IBlockingDeque.PollFirst(long, Java.Util.Concurrent.TimeUnit)
Examine
IBlockingDeque.ElementJava.Util.IDeque.First
IBlockingDeque.PeekJava.Util.IDeque.PeekFirst

Memory consistency effects: As with other concurrent collections, actions in a thread prior to placing an object into a BlockingDeque actions subsequent to the access or removal of that element from the BlockingDeque in another thread.

This interface is a member of the Java Collections Framework.

[Android Documentation]

Requirements

Namespace: Java.Util.Concurrent
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 9