MethodHandles.Constant(Class, Object) Method

Definition

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

[Android.Runtime.Register("constant", "(Ljava/lang/Class;Ljava/lang/Object;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=26)]
public static Java.Lang.Invoke.MethodHandle? Constant (Java.Lang.Class? type, Java.Lang.Object? value);
[<Android.Runtime.Register("constant", "(Ljava/lang/Class;Ljava/lang/Object;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=26)>]
static member Constant : Java.Lang.Class * Java.Lang.Object -> Java.Lang.Invoke.MethodHandle

Parameters

type
Class

the return type of the desired method handle

value
Object

the value to return

Returns

MethodHandle

a method handle of the given return type and no arguments, which always returns the given value

Attributes

Remarks

Java documentation for java.lang.invoke.MethodHandles.constant(java.lang.Class<?>, java.lang.Object).

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