Interface ThrowingObjDoubleConsumer<T,X extends Throwable>
-
- Type Parameters:
T- The type of the object argument to the operation.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 ThrowingObjDoubleConsumer<T,X extends Throwable>
Represents an operation that accepts an object-valued and adouble-valued argument, and returns no result. This is a checked-exception throwing equivalent ofObjDoubleConsumer.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaccept(T t, double value)Performs this operation on the given arguments.static <T,X extends Throwable>
ThrowingObjDoubleConsumer<T,X>checked(ObjDoubleConsumer<? super T> operation)Returns an operation that performs theoperationoperation to its input.static <T,X extends Throwable>
ThrowingObjDoubleConsumer<T,X>checked(ObjDoubleConsumer<? super T> operation, Class<X> errorType)Returns an operation that performs theoperationoperation to its input.static <T,X extends Throwable>
ThrowingObjDoubleConsumer<T,X>of(ThrowingObjDoubleConsumer<T,X> operation)Factory method for turningThrowingObjDoubleConsumer-shaped lambdas intoThrowingObjDoubleConsumers.default <E extends Throwable>
ThrowingObjDoubleConsumer<T,E>onErrorAcceptChecked(ThrowingObjDoubleConsumer<? super T,? extends E> fallback)Returns an operation that performs this operation on its input.default ObjDoubleConsumer<T>onErrorAcceptUnchecked(ObjDoubleConsumer<? super T> fallback)Returns an operation that performs this operation on its input.default ObjDoubleConsumer<T>onErrorDiscard()Returns an operation that performs this operation on its input.default <E extends Throwable>
ThrowingObjDoubleConsumer<T,E>onErrorHandleChecked(ThrowingConsumer<? super X,? extends E> errorHandler)Returns an operation that performs this operation on its input.default ObjDoubleConsumer<T>onErrorHandleUnchecked(Consumer<? super X> errorHandler)Returns an operation that performs this operation on its input.default <E extends Throwable>
ThrowingObjDoubleConsumer<T,E>onErrorThrowAsChecked(Function<? super X,? extends E> errorMapper)Returns an operation that performs this operation on its input.default <E extends RuntimeException>
ObjDoubleConsumer<T>onErrorThrowAsUnchecked(Function<? super X,? extends E> errorMapper)Returns an operation that performs this operation on its input.default ObjDoubleConsumer<T>unchecked()Returns an operation that performs this operation on its input.static <T> ObjDoubleConsumer<T>unchecked(ThrowingObjDoubleConsumer<? super T,?> operation)Returns an operation that performs theoperationoperation to its input.
-
-
-
Method Detail
-
accept
void accept(T t, double value) throws X extends Throwable
Performs this operation on the given arguments.
-
onErrorThrowAsChecked
default <E extends Throwable> ThrowingObjDoubleConsumer<T,E> onErrorThrowAsChecked(Function<? super X,? extends E> errorMapper)
Returns an operation that performs this operation on its input. Any checked exception thrown by this operation is transformed using the given error mapper, and the returned operation 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 operation.- Returns:
- An operation that transforms any thrown checked exception.
- Throws:
NullPointerException- IferrorMapperisnull.
-
onErrorThrowAsUnchecked
default <E extends RuntimeException> ObjDoubleConsumer<T> onErrorThrowAsUnchecked(Function<? super X,? extends E> errorMapper)
Returns an operation that performs this operation on its input. Any checked exception thrown by this operation is transformed using the given error mapper, and the returned operation 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 operation.- Returns:
- An operation that transforms any thrown checked exception.
- Throws:
NullPointerException- IferrorMapperisnull.
-
onErrorHandleChecked
default <E extends Throwable> ThrowingObjDoubleConsumer<T,E> onErrorHandleChecked(ThrowingConsumer<? super X,? extends E> errorHandler)
Returns an operation that performs this operation on its input. Any checked exception thrown by this operation is handled by the given error handler.- Type Parameters:
E- The type of checked exception that can be thrown by the given error handler.- Parameters:
errorHandler- The operation to perform on any checked exception thrown by this operation.- Returns:
- An operation that handles any thrown checked exception.
- Throws:
NullPointerException- IferrorHandlerisnull.
-
onErrorHandleUnchecked
default ObjDoubleConsumer<T> onErrorHandleUnchecked(Consumer<? super X> errorHandler)
Returns an operation that performs this operation on its input. Any checked exception thrown by this operation is handled by the given error handler.- Parameters:
errorHandler- The operation to perform on any checked exception thrown by this operation.- Returns:
- An operation that handles any thrown checked exception.
- Throws:
NullPointerException- IferrorHandlerisnull.
-
onErrorAcceptChecked
default <E extends Throwable> ThrowingObjDoubleConsumer<T,E> onErrorAcceptChecked(ThrowingObjDoubleConsumer<? super T,? extends E> fallback)
Returns an operation that performs this operation on its input. If this operation throws any checked exception, it is discarded and the given fallback operation is invoked.- Type Parameters:
E- The type of checked exception that can be thrown by the given fallback operation.- Parameters:
fallback- The operation to invoke if this operation throws any checked exception.- Returns:
- An operation that invokes the
fallbackoperation if this operation throws any checked exception. - Throws:
NullPointerException- Iffallbackisnull.
-
onErrorAcceptUnchecked
default ObjDoubleConsumer<T> onErrorAcceptUnchecked(ObjDoubleConsumer<? super T> fallback)
Returns an operation that performs this operation on its input. If this operation throws any checked exception, it is discarded and the given fallback operation is invoked.- Parameters:
fallback- The operation to invoke if this operation throws any checked exception.- Returns:
- An operation that invokes the
fallbackoperation if this operation throws any checked exception. - Throws:
NullPointerException- Iffallbackisnull.
-
onErrorDiscard
default ObjDoubleConsumer<T> onErrorDiscard()
Returns an operation that performs this operation on its input. Any checked exception thrown by this operation is discarded.- Returns:
- An operation that discards any thrown checked exception.
-
unchecked
default ObjDoubleConsumer<T> unchecked()
Returns an operation that performs this operation on its input. Any checked exception thrown by this operation is wrapped in anUncheckedExceptionwithout a stack trace.- Returns:
- An operation that wraps any checked exception in an
UncheckedException.
-
of
static <T,X extends Throwable> ThrowingObjDoubleConsumer<T,X> of(ThrowingObjDoubleConsumer<T,X> operation)
Factory method for turningThrowingObjDoubleConsumer-shaped lambdas intoThrowingObjDoubleConsumers.- Type Parameters:
T- The type of the object argument to the operation.X- The type of checked exception that can be thrown.- Parameters:
operation- The lambda to return asThrowingObjDoubleConsumer.- Returns:
- The given lambda as a
ThrowingObjDoubleConsumer. - Throws:
NullPointerException- Ifoperationisnull.
-
unchecked
static <T> ObjDoubleConsumer<T> unchecked(ThrowingObjDoubleConsumer<? super T,?> operation)
Returns an operation that performs theoperationoperation to its input. Any checked exception thrown by theoperationoperation is wrapped in anUncheckedException.- Type Parameters:
T- The type of the object argument to the operation.- Parameters:
operation- The operation to perform when the returned operation is performed.- Returns:
- An operation that wraps any checked exception in an
UncheckedException. - Throws:
NullPointerException- Ifoperationisnull.
-
checked
static <T,X extends Throwable> ThrowingObjDoubleConsumer<T,X> checked(ObjDoubleConsumer<? super T> operation)
Returns an operation that performs theoperationoperation to its input. Any checked exception thrown by theoperationoperation is relayed to the caller. This method allows existingObjDoubleConsumerinstances to be used whereThrowingObjDoubleConsumeris expected.- Type Parameters:
T- The type of the object argument to the operation.X- The type of checked exception that can be thrown.- Parameters:
operation- The operation to perform when the returned operation is performed.- Returns:
- An operation that wraps any checked exception in an
UncheckedException. - Throws:
NullPointerException- Ifoperationisnull.
-
checked
static <T,X extends Throwable> ThrowingObjDoubleConsumer<T,X> checked(ObjDoubleConsumer<? super T> operation, Class<X> errorType)
Returns an operation that performs theoperationoperation to its input. AnyUncheckedExceptionthrown by theoperationoperation is unwrapped if its cause is an instance oferrorType, otherwise it is relayed to the caller.- Type Parameters:
T- The type of the object argument to the operation.X- The type of checked exception that can be thrown.- Parameters:
operation- The operation to perform when the returned operation is performed.errorType- The type of checked exception that can be thrown.- Returns:
- An operation that wraps any checked exception in an
UncheckedException. - Throws:
NullPointerException- IfoperationorerrorTypeisnull.
-
-