Optional.FlatMap(IFunction) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
If a value is present, returns the result of applying the given
Optional
-bearing mapping function to the value, otherwise returns
an empty Optional
.
[Android.Runtime.Register("flatMap", "(Ljava/util/function/Function;)Ljava/util/Optional;", "", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "U" })]
public Java.Util.Optional? FlatMap (Java.Util.Functions.IFunction? mapper);
[<Android.Runtime.Register("flatMap", "(Ljava/util/function/Function;)Ljava/util/Optional;", "", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "U" })>]
member this.FlatMap : Java.Util.Functions.IFunction -> Java.Util.Optional
Parameters
- mapper
- IFunction
the mapping function to apply to a value, if present
Returns
the result of applying an Optional
-bearing 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 the result of applying the given Optional
-bearing mapping function to the value, otherwise returns an empty Optional
.
This method is similar to #map(Function)
, but the mapping function is one whose result is already an Optional
, and if invoked, flatMap
does not wrap it within an additional Optional
.
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.