共用方式為


ArrayBlockingQueue.Offer Method

Definition

Overloads

Offer(Object, Int64, TimeUnit)

Inserts the specified element at the tail of this queue, waiting up to the specified wait time for space to become available if the queue is full.

Offer(Object)

Inserts the specified element at the tail of this queue if it is possible to do so immediately without exceeding the queue's capacity, returning true upon success and false if this queue is full.

Offer(Object, Int64, TimeUnit)

Inserts the specified element at the tail of this queue, waiting up to the specified wait time for space to become available if the queue is full.

[Android.Runtime.Register("offer", "(Ljava/lang/Object;JLjava/util/concurrent/TimeUnit;)Z", "GetOffer_Ljava_lang_Object_JLjava_util_concurrent_TimeUnit_Handler")]
public virtual 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")>]
override this.Offer : Java.Lang.Object * int64 * Java.Util.Concurrent.TimeUnit -> bool

Parameters

e
Object
timeout
Int64
unit
TimeUnit

Returns

Implements

Attributes

Remarks

Inserts the specified element at the tail of this queue, waiting up to the specified wait time for space to become available if the queue is full.

Java documentation for java.util.concurrent.ArrayBlockingQueue.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

Offer(Object)

Inserts the specified element at the tail of this queue if it is possible to do so immediately without exceeding the queue's capacity, returning true upon success and false if this queue is full.

[Android.Runtime.Register("offer", "(Ljava/lang/Object;)Z", "GetOffer_Ljava_lang_Object_Handler")]
public override bool Offer (Java.Lang.Object? e);
[<Android.Runtime.Register("offer", "(Ljava/lang/Object;)Z", "GetOffer_Ljava_lang_Object_Handler")>]
override this.Offer : Java.Lang.Object -> bool

Parameters

e
Object

Returns

Implements

Attributes

Remarks

Inserts the specified element at the tail of this queue if it is possible to do so immediately without exceeding the queue's capacity, returning true upon success and false if this queue is full. This method is generally preferable to method #add, which can fail to insert an element only by throwing an exception.

Java documentation for java.util.concurrent.ArrayBlockingQueue.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