Package io.activej.common.function
Interface ConsumerEx<T>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents a
Consumer capable of throwing exceptions-
Method Summary
Modifier and TypeMethodDescriptionvoidstatic <T> ConsumerEx<T>Creates aConsumerExout ofConsumerstatic <T> Consumer<T>uncheckedOf(ConsumerEx<T> checkedFn) Creates aConsumerout ofConsumerEx
-
Method Details
-
accept
- Throws:
Exception
-
of
Creates aConsumerExout ofConsumerIf given consumer throws
UncheckedException, its cause will be propagated- Parameters:
uncheckedFn- originalConsumer- Returns:
- a consumer capable of throwing exceptions
-
uncheckedOf
Creates aConsumerout ofConsumerExIf given consumer throws a checked exception, it will be wrapped into
UncheckedExceptionand rethrownUnchecked exceptions will be handled by thread's
FatalErrorHandler- Parameters:
checkedFn- originalConsumerEx- Returns:
- a consumer
-