共用方式為


ThreadLocal.WithInitial(ISupplier) Method

Definition

Creates a thread local variable.

[Android.Runtime.Register("withInitial", "(Ljava/util/function/Supplier;)Ljava/lang/ThreadLocal;", "", ApiSince=26)]
[Java.Interop.JavaTypeParameters(new System.String[] { "S" })]
public static Java.Lang.ThreadLocal WithInitial (Java.Util.Functions.ISupplier supplier);
[<Android.Runtime.Register("withInitial", "(Ljava/util/function/Supplier;)Ljava/lang/ThreadLocal;", "", ApiSince=26)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "S" })>]
static member WithInitial : Java.Util.Functions.ISupplier -> Java.Lang.ThreadLocal

Parameters

supplier
ISupplier

the supplier to be used to determine the initial value

Returns

a new thread local variable

Attributes

Remarks

Creates a thread local variable. The initial value of the variable is determined by invoking the get method on the Supplier.

Added in 1.8.

Java documentation for java.lang.ThreadLocal.withInitial(java.util.function.Supplier<? extends S>).

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