Freigeben über


ConcurrentLinkedQueue.Size Method

Definition

Returns the number of elements in this queue.

[Android.Runtime.Register("size", "()I", "GetSizeHandler")]
public override int Size ();
[<Android.Runtime.Register("size", "()I", "GetSizeHandler")>]
override this.Size : unit -> int

Returns

the number of elements in this queue

Implements

Attributes

Remarks

Returns the number of elements in this queue. If this queue contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Beware that, unlike in most collections, this method is <em>NOT</em> a constant-time operation. Because of the asynchronous nature of these queues, determining the current number of elements requires an O(n) traversal. Additionally, if elements are added or removed during execution of this method, the returned result may be inaccurate. Thus, this method is typically not very useful in concurrent applications.

Java documentation for java.util.concurrent.ConcurrentLinkedQueue.size().

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