Freigeben über


OptionalInt.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", "()I", "", ApiSince=33)]
public int OrElseThrow ();
[<Android.Runtime.Register("orElseThrow", "()I", "", ApiSince=33)>]
member this.OrElseThrow : unit -> int

Returns

the value described by this OptionalInt

Attributes

Remarks

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

Added in 10.

Java documentation for java.util.OptionalInt.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;)I", "", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "X extends java.lang.Throwable" })]
public int OrElseThrow (Java.Util.Functions.ISupplier? exceptionSupplier);
[<Android.Runtime.Register("orElseThrow", "(Ljava/util/function/Supplier;)I", "", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "X extends java.lang.Throwable" })>]
member this.OrElseThrow : Java.Util.Functions.ISupplier -> int

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.OptionalInt.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