Partager via


OptionalDouble.OrElseThrow Method

Definition

Overloads

OrElseThrow()

If a value is present, returns the value, otherwise throws NoSuchElementException.

OrElseThrow(ISupplier)

If a value is present, returns the value, otherwise throws an exception produced by the exception supplying function.

OrElseThrow()

If a value is present, returns the value, otherwise throws NoSuchElementException.

[Android.Runtime.Register("orElseThrow", "()D", "", ApiSince=33)]
public double OrElseThrow ();
[<Android.Runtime.Register("orElseThrow", "()D", "", ApiSince=33)>]
member this.OrElseThrow : unit -> double

Returns

the value described by this OptionalDouble

Attributes

Remarks

If a value is present, returns the value, otherwise throws NoSuchElementException.

Added in 10.

Java documentation for java.util.OptionalDouble.orElseThrow().

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

OrElseThrow(ISupplier)

If a value is present, returns the value, otherwise throws an exception produced by the exception supplying function.

[Android.Runtime.Register("orElseThrow", "(Ljava/util/function/Supplier;)D", "", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "X extends java.lang.Throwable" })]
public double OrElseThrow (Java.Util.Functions.ISupplier? exceptionSupplier);
[<Android.Runtime.Register("orElseThrow", "(Ljava/util/function/Supplier;)D", "", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "X extends java.lang.Throwable" })>]
member this.OrElseThrow : Java.Util.Functions.ISupplier -> double

Parameters

exceptionSupplier
ISupplier

the supplying function that produces an exception to be thrown

Returns

the value, if present

Attributes

Remarks

Java documentation for java.util.OptionalDouble.orElseThrow(java.util.function.Supplier<? extends X>).

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