Udostępnij za pośrednictwem


MethodHandles.Empty(MethodType) Method

Definition

Produces a method handle of the requested type which ignores any arguments, does nothing, and returns a suitable default depending on the return type.

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

Parameters

type
MethodType

the type of the desired method handle

Returns

a constant method handle of the given type, which returns a default value of the given return type

Attributes

Remarks

Produces a method handle of the requested type which ignores any arguments, does nothing, and returns a suitable default depending on the return type. That is, it returns a zero primitive value, a null, or void.

The returned method handle is equivalent to dropArguments(zero(type.returnType()), 0, type.parameterList()).

Added in 9.

Java documentation for java.lang.invoke.MethodHandles.empty(java.lang.invoke.MethodType).

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