다음을 통해 공유


Optional.Map(IFunction) Method

Definition

If a value is present, returns an Optional describing (as if by #ofNullable) the result of applying the given mapping function to the value, otherwise returns an empty Optional.

[Android.Runtime.Register("map", "(Ljava/util/function/Function;)Ljava/util/Optional;", "", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "U" })]
public Java.Util.Optional? Map (Java.Util.Functions.IFunction? mapper);
[<Android.Runtime.Register("map", "(Ljava/util/function/Function;)Ljava/util/Optional;", "", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "U" })>]
member this.Map : Java.Util.Functions.IFunction -> Java.Util.Optional

Parameters

mapper
IFunction

the mapping function to apply to a value, if present

Returns

an Optional describing the result of applying a mapping function to the value of this Optional, if a value is present, otherwise an empty Optional

Attributes

Remarks

If a value is present, returns an Optional describing (as if by #ofNullable) the result of applying the given mapping function to the value, otherwise returns an empty Optional.

If the mapping function returns a null result then this method returns an empty Optional.

Java documentation for java.util.Optional.map(java.util.function.Function<? super T, ? extends U>).

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