orElseThrow

open fun <X : Throwable?> orElseThrow(exceptionSupplier: Supplier<out X>): T

Return the object that was bound, or throw an exception to be created by the provided supplier if no value has been bound.

Return

the present value

Parameters

<X>

the type of the exception to be thrown

exceptionSupplier

the supplier which will return the exception to be thrown

Throws

if there is no value present