public <X extends Throwable> double orElseThrow (Supplier<? extends X> exceptionSupplier) throws X

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

Parameters:
<X>    Type of the exception to be thrown
exceptionSupplier    the supplying function that produces an exception to be thrown

Returns:  the value, if present

Exceptions:
X    if no value is present
NullPointerException    if no value is present and the exception supplying function is null

@apiNote A method reference to the exception constructor with an empty argument list can be used as the supplier. For example, IllegalStateException::new