OptionalInt.OrElseThrow 方法

定义

重载

名称 说明
OrElseThrow()

如果存在值,则返回该值,否则将 NoSuchElementException引发 。

OrElseThrow(ISupplier)

如果存在某个值,则返回该值,否则将引发异常提供函数生成的异常。

OrElseThrow()

如果存在值,则返回该值,否则将 NoSuchElementException引发 。

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

返回

由此描述的值 OptionalInt

属性

注解

如果存在值,则返回该值,否则将 NoSuchElementException引发 。

已在 10 中添加。

Java文档java.util.OptionalInt.orElseThrow()

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于

OrElseThrow(ISupplier)

如果存在某个值,则返回该值,否则将引发异常提供函数生成的异常。

[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

参数

exceptionSupplier
ISupplier

生成要引发的异常的提供函数

返回

值(如果存在)

属性

注解

Java文档java.util.OptionalInt.orElseThrow(java.util.function.Supplier<? extends X>)

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于