Udostępnij za pośrednictwem


IBlockingDeque.Offer Method

Definition

Overloads

Offer(Object)

Inserts the specified element into the queue represented by this deque (in other words, at the tail of this deque) if it is possible to do so immediately without violating capacity restrictions, returning true upon success and false if no space is currently available.

Offer(Object, Int64, TimeUnit)

Inserts the specified element into the queue represented by this deque (in other words, at the tail of this deque), waiting up to the specified wait time if necessary for space to become available.

Offer(Object)

Inserts the specified element into the queue represented by this deque (in other words, at the tail of this deque) if it is possible to do so immediately without violating capacity restrictions, returning true upon success and false if no space is currently available.

[Android.Runtime.Register("offer", "(Ljava/lang/Object;)Z", "GetOffer_Ljava_lang_Object_Handler:Java.Util.Concurrent.IBlockingDequeInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public bool Offer (Java.Lang.Object? e);
[<Android.Runtime.Register("offer", "(Ljava/lang/Object;)Z", "GetOffer_Ljava_lang_Object_Handler:Java.Util.Concurrent.IBlockingDequeInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member Offer : Java.Lang.Object -> bool

Parameters

e
Object

the element to add

Returns

Implements

Attributes

Remarks

Inserts the specified element into the queue represented by this deque (in other words, at the tail of this deque) if it is possible to do so immediately without violating capacity restrictions, returning true upon success and false if no space is currently available. When using a capacity-restricted deque, this method is generally preferable to the #add method, which can fail to insert an element only by throwing an exception.

This method is equivalent to #offerLast(Object) offerLast.

Java documentation for java.util.concurrent.BlockingDeque.offer(E).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Offer(Object, Int64, TimeUnit)

Inserts the specified element into the queue represented by this deque (in other words, at the tail of this deque), waiting up to the specified wait time if necessary for space to become available.

[Android.Runtime.Register("offer", "(Ljava/lang/Object;JLjava/util/concurrent/TimeUnit;)Z", "GetOffer_Ljava_lang_Object_JLjava_util_concurrent_TimeUnit_Handler:Java.Util.Concurrent.IBlockingDequeInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public bool Offer (Java.Lang.Object? e, long timeout, Java.Util.Concurrent.TimeUnit? unit);
[<Android.Runtime.Register("offer", "(Ljava/lang/Object;JLjava/util/concurrent/TimeUnit;)Z", "GetOffer_Ljava_lang_Object_JLjava_util_concurrent_TimeUnit_Handler:Java.Util.Concurrent.IBlockingDequeInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member Offer : Java.Lang.Object * int64 * Java.Util.Concurrent.TimeUnit -> bool

Parameters

e
Object

the element to add

timeout
Int64
unit
TimeUnit

Returns

true if the element was added to this deque, else false

Implements

Attributes

Remarks

Inserts the specified element into the queue represented by this deque (in other words, at the tail of this deque), waiting up to the specified wait time if necessary for space to become available.

This method is equivalent to #offerLast(Object,long,TimeUnit) offerLast.

Java documentation for java.util.concurrent.BlockingDeque.offer(E, long, java.util.concurrent.TimeUnit).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to