MethodHandles.ArrayConstructor(Class) Method

Definition

Produces a method handle constructing arrays of a desired type, as if by the anewarray bytecode.

[Android.Runtime.Register("arrayConstructor", "(Ljava/lang/Class;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=33)]
public static Java.Lang.Invoke.MethodHandle? ArrayConstructor (Java.Lang.Class? arrayClass);
[<Android.Runtime.Register("arrayConstructor", "(Ljava/lang/Class;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=33)>]
static member ArrayConstructor : Java.Lang.Class -> Java.Lang.Invoke.MethodHandle

Parameters

arrayClass
Class

an array type

Returns

a method handle which can create arrays of the given type

Attributes

Remarks

Produces a method handle constructing arrays of a desired type, as if by the anewarray bytecode. The return type of the method handle will be the array type. The type of its sole argument will be int, which specifies the size of the array.

If the returned method handle is invoked with a negative array size, a NegativeArraySizeException will be thrown.

Added in 9.

Java documentation for java.lang.invoke.MethodHandles.arrayConstructor(java.lang.Class<?>).

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