MethodHandles.Zero(Class) Method

Definition

Produces a constant method handle of the requested return type which returns the default value for that type every time it is invoked.

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

Parameters

type
Class

the expected return type of the desired method handle

Returns

a constant method handle that takes no arguments and returns the default value of the given type (or void, if the type is void)

Attributes

Remarks

Produces a constant method handle of the requested return type which returns the default value for that type every time it is invoked. The resulting constant method handle will have no side effects.

The returned method handle is equivalent to empty(methodType(type)). It is also equivalent to explicitCastArguments(constant(Object.class, null), methodType(type)), since explicitCastArguments converts null to default values.

Added in 9.

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