Partager via


MethodHandles.ArrayLength(Class) Method

Definition

Produces a method handle returning the length of an array, as if by the arraylength bytecode.

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

Parameters

arrayClass
Class

an array type

Returns

a method handle which can retrieve the length of an array of the given array type

Attributes

Remarks

Produces a method handle returning the length of an array, as if by the arraylength bytecode. The type of the method handle will have int as return type, and its sole argument will be the array type.

If the returned method handle is invoked with a null array reference, a NullPointerException will be thrown.

Added in 9.

Java documentation for java.lang.invoke.MethodHandles.arrayLength(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