Dela via


Optional.OrElseGet(ISupplier) Method

Definition

If a value is present, returns the value, otherwise returns the result produced by the supplying function.

[Android.Runtime.Register("orElseGet", "(Ljava/util/function/Supplier;)Ljava/lang/Object;", "", ApiSince=24)]
public Java.Lang.Object? OrElseGet (Java.Util.Functions.ISupplier? supplier);
[<Android.Runtime.Register("orElseGet", "(Ljava/util/function/Supplier;)Ljava/lang/Object;", "", ApiSince=24)>]
member this.OrElseGet : Java.Util.Functions.ISupplier -> Java.Lang.Object

Parameters

supplier
ISupplier

the supplying function that produces a value to be returned

Returns

the value, if present, otherwise the result produced by the supplying function

Attributes

Remarks

If a value is present, returns the value, otherwise returns the result produced by the supplying function.

Java documentation for java.util.Optional.orElseGet(java.util.function.Supplier<? extends 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