Partager via


MethodHandles.ArrayElementVarHandle(Class) Method

Definition

Produces a VarHandle giving access to elements of an array of type arrayClass.

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

Parameters

arrayClass
Class

the class of an array, of type T[]

Returns

a VarHandle giving access to elements of an array

Attributes

Remarks

Produces a VarHandle giving access to elements of an array of type arrayClass. The VarHandle's variable type is the component type of arrayClass and the list of coordinate types is (arrayClass, int), where the int coordinate type corresponds to an argument that is an index into an array.

Certain access modes of the returned VarHandle are unsupported under the following conditions: <ul> <li>if the component type is anything other than byte, short, char, int, long, float, or double then numeric atomic update access modes are unsupported. <li>if the field type is anything other than boolean, byte, short, char, int or long then bitwise atomic update access modes are unsupported. </ul>

If the component type is float or double then numeric and atomic update access modes compare values using their bitwise representation (see Float#floatToRawIntBits and Double#doubleToRawLongBits, respectively).

Added in 9.

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