Język

AbstractCollection.ToArray Method

Definition

Overloads

Name Description
ToArray(Object[])

Returns an array containing all of the elements in this collection.

ToArray()

Returns an array containing all of the elements in this collection.

ToArray(Object[])

Returns an array containing all of the elements in this collection.

[Android.Runtime.Register("toArray", "([Ljava/lang/Object;)[Ljava/lang/Object;", "GetToArray_arrayLjava_lang_Object_Handler")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public virtual Java.Lang.Object[] ToArray(Java.Lang.Object[] a);
[<Android.Runtime.Register("toArray", "([Ljava/lang/Object;)[Ljava/lang/Object;", "GetToArray_arrayLjava_lang_Object_Handler")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
override this.ToArray : Java.Lang.Object[] -> Java.Lang.Object[]

Parameters

a
Object[]

The array that receives the elements if it is large enough.

Returns

Object[]

an array containing all of the elements in this collection

Implements

Attributes

Remarks

If the collection fits in a, its elements are copied into that array. The returned managed array is a separate array. If the collection fits in a with room to spare, the element immediately following the collection's elements is set to null. This can be used to determine the collection's length only if the collection contains no null elements. If this collection makes any guarantees about the order in which its iterator returns elements, this method returns the elements in the same order.

Java documentation for java.util.AbstractCollection.toArray(T[]).

Java reference for java.util.AbstractCollection.toArray.

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

ToArray()

Returns an array containing all of the elements in this collection.

[Android.Runtime.Register("toArray", "()[Ljava/lang/Object;", "GetToArrayHandler")]
public virtual Java.Lang.Object[] ToArray();
[<Android.Runtime.Register("toArray", "()[Ljava/lang/Object;", "GetToArrayHandler")>]
override this.ToArray : unit -> Java.Lang.Object[]

Returns

Object[]

an array, whose runtime component type is Object, containing all of the elements in this collection

Implements

Attributes

Remarks

Returns an array containing all of the elements in this collection. If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. The returned array's runtime component type is Object. The returned array will be "safe" in that no references to it are maintained by this collection. (In other words, this method must allocate a new array even if this collection is backed by an array). The caller is thus free to modify the returned array.

Java documentation for java.util.AbstractCollection.toArray().

Java reference for java.util.AbstractCollection.toArray.

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