Udostępnij za pośrednictwem


Optional.OfNullable(Object) Method

Definition

Returns an Optional describing the given value, if non-null, otherwise returns an empty Optional.

[Android.Runtime.Register("ofNullable", "(Ljava/lang/Object;)Ljava/util/Optional;", "", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static Java.Util.Optional? OfNullable (Java.Lang.Object? value);
[<Android.Runtime.Register("ofNullable", "(Ljava/lang/Object;)Ljava/util/Optional;", "", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member OfNullable : Java.Lang.Object -> Java.Util.Optional

Parameters

value
Object

the possibly-null value to describe

Returns

an Optional with a present value if the specified value is non-null, otherwise an empty Optional

Attributes

Remarks

Returns an Optional describing the given value, if non-null, otherwise returns an empty Optional.

Java documentation for java.util.Optional.ofNullable(T).

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