Interface ThrowingDoubleBinaryOperator<X extends Throwable>
-
- Type Parameters:
X- The type of checked exception that can be thrown.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ThrowingDoubleBinaryOperator<X extends Throwable>
Represents an operation upon twodouble-valued operands and producing adouble-valued result. This is a checked-exception throwing equivalent ofDoubleBinaryOperator.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description doubleapplyAsDouble(double left, double right)Applies this operator to the given operands.static <X extends Throwable>
ThrowingDoubleBinaryOperator<X>checked(DoubleBinaryOperator operator)Returns a binary operator that applies theoperatoroperator to its input.static <X extends Throwable>
ThrowingDoubleBinaryOperator<X>checked(DoubleBinaryOperator operator, Class<X> errorType)Returns a binary operator that applies theoperatoroperator to its input.static <X extends Throwable>
ThrowingDoubleBinaryOperator<X>of(ThrowingDoubleBinaryOperator<X> operator)Factory method for turningThrowingBinaryDoubleOperator-shaped lambdas intoThrowingBinaryDoubleOpreators.default <E extends Throwable>
ThrowingDoubleBinaryOperator<E>onErrorApplyChecked(ThrowingDoubleBinaryOperator<? extends E> fallback)Returns a binary operator that applies this operator to its input.default DoubleBinaryOperatoronErrorApplyUnchecked(DoubleBinaryOperator fallback)Returns a binary operator that applies this operator to its input.default <E extends Throwable>
ThrowingDoubleBinaryOperator<E>onErrorGetChecked(ThrowingDoubleSupplier<? extends E> fallback)Returns a binary operator that applies this operator to its input.default DoubleBinaryOperatoronErrorGetUnchecked(DoubleSupplier fallback)Returns a binary operator that applies this operator to its input.default <E extends Throwable>
ThrowingDoubleBinaryOperator<E>onErrorHandleChecked(ThrowingToDoubleFunction<? super X,? extends E> errorHandler)Returns a binary operator that applies this operator to its input.default DoubleBinaryOperatoronErrorHandleUnchecked(ToDoubleFunction<? super X> errorHandler)Returns a binary operator that applies this operator to its input.default DoubleBinaryOperatoronErrorReturn(double fallback)Returns a binary operator that applies this operator to its input.default <E extends Throwable>
ThrowingDoubleBinaryOperator<E>onErrorThrowAsChecked(Function<? super X,? extends E> errorMapper)Returns a binary operator that applies this operator to its input.default <E extends RuntimeException>
DoubleBinaryOperatoronErrorThrowAsUnchecked(Function<? super X,? extends E> errorMapper)Returns a binary operator that applies this operator to its input.default DoubleBinaryOperatorunchecked()Returns a binary operator that applies this operator to its input.static DoubleBinaryOperatorunchecked(ThrowingDoubleBinaryOperator<?> operator)Returns a binary operator that applies theoperatoroperator to its input.
-
-
-
Method Detail
-
applyAsDouble
double applyAsDouble(double left, double right) throws X extends ThrowableApplies this operator to the given operands.
-
onErrorThrowAsChecked
default <E extends Throwable> ThrowingDoubleBinaryOperator<E> onErrorThrowAsChecked(Function<? super X,? extends E> errorMapper)
Returns a binary operator that applies this operator to its input. Any checked exception thrown by this operator is transformed using the given error mapper, and the returned operator throws the transformation result.- Type Parameters:
E- The type of checked exception to transform to.- Parameters:
errorMapper- The function to use to transform any checked exception thrown by this operator.- Returns:
- A binary operator that transforms any thrown checked exception.
- Throws:
NullPointerException- IferrorMapperisnull.
-
onErrorThrowAsUnchecked
default <E extends RuntimeException> DoubleBinaryOperator onErrorThrowAsUnchecked(Function<? super X,? extends E> errorMapper)
Returns a binary operator that applies this operator to its input. Any checked exception thrown by this operator is transformed using the given error mapper, and the returned operator throws the transformation result.- Type Parameters:
E- The type of unchecked exception to transform to.- Parameters:
errorMapper- The function to use to transform any checked exception thrown by this operator.- Returns:
- A binary operator that transforms any thrown checked exception.
- Throws:
NullPointerException- IferrorMapperisnull.
-
onErrorHandleChecked
default <E extends Throwable> ThrowingDoubleBinaryOperator<E> onErrorHandleChecked(ThrowingToDoubleFunction<? super X,? extends E> errorHandler)
Returns a binary operator that applies this operator to its input. Any checked exception thrown by this operator is transformed using the given error handler, and the returned operator returns the transformation result.- Type Parameters:
E- The type of checked exception that can be thrown by the given error handler.- Parameters:
errorHandler- The function to use to transform any checked exception thrown by this operator.- Returns:
- A binary operator that transforms any thrown checked exception.
- Throws:
NullPointerException- IferrorHandlerisnull.
-
onErrorHandleUnchecked
default DoubleBinaryOperator onErrorHandleUnchecked(ToDoubleFunction<? super X> errorHandler)
Returns a binary operator that applies this operator to its input. Any checked exception thrown by this operator is transformed using the given error handler, and the returned operator returns the transformation result.- Parameters:
errorHandler- The function to use to transform any checked exception thrown by this operator.- Returns:
- A binary operator that transforms any thrown checked exception.
- Throws:
NullPointerException- IferrorHandlerisnull.
-
onErrorApplyChecked
default <E extends Throwable> ThrowingDoubleBinaryOperator<E> onErrorApplyChecked(ThrowingDoubleBinaryOperator<? extends E> fallback)
Returns a binary operator that applies this operator to its input. If this operator throws any checked exception, it is discarded and the given fallback operator is invoked.- Type Parameters:
E- The type of checked exception that can be thrown by the given fallback operator.- Parameters:
fallback- The operator to invoke if this operator throws any checked exception.- Returns:
- A binary operator that invokes the
fallbackoperator if this operator throws any checked exception. - Throws:
NullPointerException- Iffallbackisnull.
-
onErrorApplyUnchecked
default DoubleBinaryOperator onErrorApplyUnchecked(DoubleBinaryOperator fallback)
Returns a binary operator that applies this operator to its input. If this operator throws any checked exception, it is discarded and the given fallback operator is invoked.- Parameters:
fallback- The operator to invoke if this operator throws any checked exception.- Returns:
- A binary operator that invokes the
fallbackoperator if this operator throws any checked exception. - Throws:
NullPointerException- Iffallbackisnull.
-
onErrorGetChecked
default <E extends Throwable> ThrowingDoubleBinaryOperator<E> onErrorGetChecked(ThrowingDoubleSupplier<? extends E> fallback)
Returns a binary operator that applies this operator to its input. If this operator throws any checked exception, it is discarded and the given fallback supplier is invoked.- Type Parameters:
E- The type of checked exception that can be thrown by the given fallback supplier.- Parameters:
fallback- The supplier to produce the value to return if this operator throws any checked exception.- Returns:
- A binary operator that invokes the
fallbacksupplier if this operator throws any checked exception. - Throws:
NullPointerException- Iffallbackisnull.
-
onErrorGetUnchecked
default DoubleBinaryOperator onErrorGetUnchecked(DoubleSupplier fallback)
Returns a binary operator that applies this operator to its input. If this operator throws any checked exception, it is discarded and the given fallback supplier is invoked.- Parameters:
fallback- The supplier to produce the value to return if this operator throws any checked exception.- Returns:
- A binary operator that invokes the
fallbacksupplier if this operator throws any checked exception. - Throws:
NullPointerException- Iffallbackisnull.
-
onErrorReturn
default DoubleBinaryOperator onErrorReturn(double fallback)
Returns a binary operator that applies this operator to its input. If this operator throws any checked exception, it is discarded and the given fallback value is returned.- Parameters:
fallback- The value to return if this operator throws any checked exception.- Returns:
- A binary operator that returns the
fallbackvalue if this operator throws any checked exception.
-
unchecked
default DoubleBinaryOperator unchecked()
Returns a binary operator that applies this operator to its input. Any checked exception thrown by this operator is wrapped in anUncheckedExceptionwithout a stack trace.- Returns:
- A binary operator that wraps any checked exception in an
UncheckedException.
-
of
static <X extends Throwable> ThrowingDoubleBinaryOperator<X> of(ThrowingDoubleBinaryOperator<X> operator)
Factory method for turningThrowingBinaryDoubleOperator-shaped lambdas intoThrowingBinaryDoubleOpreators.- Type Parameters:
X- The type of checked exception that can be thrown.- Parameters:
operator- The lambda to return asThrowingDoubleBinaryOperator.- Returns:
- The given lambda as a
ThrowingDoubleBinaryOperator. - Throws:
NullPointerException- Ifoperatorisnull.
-
unchecked
static DoubleBinaryOperator unchecked(ThrowingDoubleBinaryOperator<?> operator)
Returns a binary operator that applies theoperatoroperator to its input. Any checked exception thrown by theoperatoroperator is wrapped in anUncheckedException.- Parameters:
operator- The operator to apply when the returned operator is applied.- Returns:
- A binary operator that wraps any checked exception in an
UncheckedException. - Throws:
NullPointerException- Ifoperatorisnull.
-
checked
static <X extends Throwable> ThrowingDoubleBinaryOperator<X> checked(DoubleBinaryOperator operator)
Returns a binary operator that applies theoperatoroperator to its input. Any unchecked exception thrown by theoperatoroperator is relayed to the caller. This method allows existingDoubleBinaryOperatorinstances to be used whereThrowingDoubleBinaryOperatoris expected.- Type Parameters:
X- The type of checked exception that can be thrown.- Parameters:
operator- The operator to apply when the returned operator is applied.- Returns:
- A binary operator that wraps any checked exception in an
UncheckedException. - Throws:
NullPointerException- Ifoperatorisnull.
-
checked
static <X extends Throwable> ThrowingDoubleBinaryOperator<X> checked(DoubleBinaryOperator operator, Class<X> errorType)
Returns a binary operator that applies theoperatoroperator to its input. AnyUncheckedExceptionthrown by theoperatoroperator is unwrapped if its cause is an instance oferrorType, otherwise it is relayed to the caller.- Type Parameters:
X- The type of checked exception that can be thrown.- Parameters:
operator- The operator to apply when the returned operator is applied.errorType- The type of checked exception that can be thrown.- Returns:
- A binary operator that wraps any checked exception in an
UncheckedException. - Throws:
NullPointerException- IfoperatororerrorTypeisnull.
-
-