Interface DoubleConsumerWithException<E extends Exception>
-
- Type Parameters:
E
- the type of the potential exception of the operation
- All Superinterfaces:
ExceptionHandlerSupport<DoubleConsumer,DoubleConsumer,DoubleConsumerWithException<E>>
,NoReturnExceptionHandlerSupport<DoubleConsumer,DoubleFunction<CompletionStage<Void>>,DoubleConsumerWithException<E>>
- 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 DoubleConsumerWithException<E extends Exception> extends NoReturnExceptionHandlerSupport<DoubleConsumer,DoubleFunction<CompletionStage<Void>>,DoubleConsumerWithException<E>>
Represents an operation that accepts a singledouble
-valued argument, may throw exception and returns no result. This is the primitive type specialization ofConsumerWithException
fordouble
. Unlike most other functional interfaces,DoubleConsumerWithException
is expected to operate via side-effects.General contract
void accept(double value) throws E
- The functional method.- uncheck - Return a
DoubleConsumer
- lift - Return a
DoubleConsumer
- ignore - Return a
DoubleConsumer
- See Also:
DoubleConsumer
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
accept(double value)
Performs this operation on the given argument.default DoubleConsumerWithException<E>
andThen(DoubleConsumerWithException<? extends E> after)
Returns a composedDoubleConsumerWithException
that performs, in sequence, this operation followed by theafter
operation.static <E extends Exception>
ConsumerWithException<Double,E>asConsumer(DoubleConsumerWithException<E> operation)
Converts aDoubleConsumerWithException
to aConsumerWithException
.static <E extends Exception>
DoubleConsumerWithException<E>failing(Supplier<E> exceptionBuilder)
Returns an operation that always throw exception.default DoubleConsumer
ignore()
Converts thisDoubleConsumerWithException
to a liftedDoubleConsumer
ignoring exception.static <E extends Exception>
DoubleConsumerignored(DoubleConsumerWithException<E> operation)
Converts aDoubleConsumerWithException
to a liftedDoubleConsumer
ignoring exception.static <E extends Exception>
DoubleConsumerlifted(DoubleConsumerWithException<E> operation)
Converts aDoubleConsumerWithException
to a liftedDoubleConsumer
ignoring exception.default DoubleFunction<CompletionStage<Void>>
stage()
Converts thisDoubleConsumerWithException
to a stagedDoubleFunction
that return aCompletionStage
.static <E extends Exception>
DoubleFunction<CompletionStage<Void>>staged(DoubleConsumerWithException<E> operation)
Converts aDoubleConsumerWithException
to a stagedDoubleFunction
.default DoubleConsumer
uncheck()
Converts thisDoubleConsumerWithException
to aDoubleConsumer
that wraps exception toRuntimeException
.static <E extends Exception>
DoubleConsumerunchecked(DoubleConsumerWithException<E> operation)
Converts aDoubleConsumerWithException
to aDoubleConsumer
that wraps exception toRuntimeException
.static <E extends Exception>
DoubleConsumerunchecked(DoubleConsumerWithException<E> operation, Function<Exception,RuntimeException> exceptionMapper)
Converts aDoubleConsumerWithException
to aDoubleConsumer
that wraps exception toRuntimeException
by using the provided mapping function.-
Methods inherited from interface ch.powerunit.extensions.exceptions.ExceptionHandlerSupport
documented, exceptionMapper
-
Methods inherited from interface ch.powerunit.extensions.exceptions.NoReturnExceptionHandlerSupport
lift, notThrowingHandler, throwingHandler
-
-
-
-
Method Detail
-
accept
void accept(double value) throws E extends Exception
Performs this operation on the given argument.- Parameters:
value
- the input argument- Throws:
E
- any exceptionE extends Exception
- See Also:
DoubleConsumer.accept(double)
-
uncheck
default DoubleConsumer uncheck()
Converts thisDoubleConsumerWithException
to aDoubleConsumer
that wraps exception toRuntimeException
.- Specified by:
uncheck
in interfaceExceptionHandlerSupport<DoubleConsumer,DoubleConsumer,DoubleConsumerWithException<E extends Exception>>
- Specified by:
uncheck
in interfaceNoReturnExceptionHandlerSupport<DoubleConsumer,DoubleFunction<CompletionStage<Void>>,DoubleConsumerWithException<E extends Exception>>
- Returns:
- the unchecked operation
- See Also:
unchecked(DoubleConsumerWithException)
,unchecked(DoubleConsumerWithException, Function)
-
ignore
default DoubleConsumer ignore()
Converts thisDoubleConsumerWithException
to a liftedDoubleConsumer
ignoring exception.- Specified by:
ignore
in interfaceExceptionHandlerSupport<DoubleConsumer,DoubleConsumer,DoubleConsumerWithException<E extends Exception>>
- Specified by:
ignore
in interfaceNoReturnExceptionHandlerSupport<DoubleConsumer,DoubleFunction<CompletionStage<Void>>,DoubleConsumerWithException<E extends Exception>>
- Returns:
- the operation that ignore error
- See Also:
ignored(DoubleConsumerWithException)
-
stage
default DoubleFunction<CompletionStage<Void>> stage()
Converts thisDoubleConsumerWithException
to a stagedDoubleFunction
that return aCompletionStage
.- Specified by:
stage
in interfaceNoReturnExceptionHandlerSupport<DoubleConsumer,DoubleFunction<CompletionStage<Void>>,DoubleConsumerWithException<E extends Exception>>
- Returns:
- the staged operation.
- Since:
- 1.1.0
-
andThen
default DoubleConsumerWithException<E> andThen(DoubleConsumerWithException<? extends E> after)
Returns a composedDoubleConsumerWithException
that performs, in sequence, this operation followed by theafter
operation. If performing either operation throws an exception, it is relayed to the caller of the composed operation. If performing this operation throws an exception, theafter
operation will not be performed.- Parameters:
after
- the operation to perform after this operation- Returns:
- a composed
DoubleConsumer
that performs in sequence this operation followed by theafter
operation - Throws:
NullPointerException
- ifafter
is null- See Also:
DoubleConsumer.andThen(DoubleConsumer)
-
failing
static <E extends Exception> DoubleConsumerWithException<E> failing(Supplier<E> exceptionBuilder)
Returns an operation that always throw exception.- Type Parameters:
E
- the type of the exception- Parameters:
exceptionBuilder
- the supplier to create the exception- Returns:
- an operation that always throw exception
-
unchecked
static <E extends Exception> DoubleConsumer unchecked(DoubleConsumerWithException<E> operation)
Converts aDoubleConsumerWithException
to aDoubleConsumer
that wraps exception toRuntimeException
.- Type Parameters:
E
- the type of the potential exception- Parameters:
operation
- to be unchecked- Returns:
- the unchecked operation
- Throws:
NullPointerException
- if operation is null- See Also:
uncheck()
,unchecked(DoubleConsumerWithException, Function)
-
unchecked
static <E extends Exception> DoubleConsumer unchecked(DoubleConsumerWithException<E> operation, Function<Exception,RuntimeException> exceptionMapper)
Converts aDoubleConsumerWithException
to aDoubleConsumer
that wraps exception toRuntimeException
by using the provided mapping function.- Type Parameters:
E
- the type of the potential exception- Parameters:
operation
- the be uncheckedexceptionMapper
- a function to convert the exception to the runtime exception.- Returns:
- the unchecked operation
- Throws:
NullPointerException
- if operation or exceptionMapper is null- See Also:
uncheck()
,unchecked(DoubleConsumerWithException)
-
lifted
static <E extends Exception> DoubleConsumer lifted(DoubleConsumerWithException<E> operation)
Converts aDoubleConsumerWithException
to a liftedDoubleConsumer
ignoring exception.- Type Parameters:
E
- the type of the potential exception- Parameters:
operation
- to be lifted- Returns:
- the lifted operation
- Throws:
NullPointerException
- if operation is null- See Also:
NoReturnExceptionHandlerSupport.lift()
-
ignored
static <E extends Exception> DoubleConsumer ignored(DoubleConsumerWithException<E> operation)
Converts aDoubleConsumerWithException
to a liftedDoubleConsumer
ignoring exception.- Type Parameters:
E
- the type of the potential exception- Parameters:
operation
- to be lifted- Returns:
- the lifted operation
- Throws:
NullPointerException
- if operation is null- See Also:
ignore()
-
staged
static <E extends Exception> DoubleFunction<CompletionStage<Void>> staged(DoubleConsumerWithException<E> operation)
Converts aDoubleConsumerWithException
to a stagedDoubleFunction
.- Type Parameters:
E
- the type of the potential exception- Parameters:
operation
- to be staged- Returns:
- the staged operation
- Throws:
NullPointerException
- if operation is null- Since:
- 1.1.0
-
asConsumer
static <E extends Exception> ConsumerWithException<Double,E> asConsumer(DoubleConsumerWithException<E> operation)
Converts aDoubleConsumerWithException
to aConsumerWithException
.- Type Parameters:
E
- the type of the potential exception- Parameters:
operation
- to be converted- Returns:
- the consumer
- Throws:
NullPointerException
- if operation is null
-
-