T - the type of the input to the consumerpublic interface NamedConsumer<T> extends HasName, Consumer<T>
NamedConsumer can be used in contexts where consumers are managed and identified by their names.
| Modifier and Type | Method and Description |
|---|---|
static <T> @NotNull NamedConsumer<T> |
of(@NotNull Consumer<T> consumer,
@NotNull String name)
Creates a NamedConsumer instance from the given consumer and name.
|
static <T> @NotNull NamedConsumer<T> |
ofThrowing(@NotNull ThrowingConsumer<T,?> consumer,
@NotNull String name)
Creates a NamedConsumer instance from the given ThrowingConsumer and name.
|
@NotNull static <T> @NotNull NamedConsumer<T> of(@NotNull @NotNull Consumer<T> consumer, @NotNull @NotNull String name)
consumer - the Consumer instancename - the name to associate with the consumerNullPointerException - if either consumer or name is null@NotNull static <T> @NotNull NamedConsumer<T> ofThrowing(@NotNull @NotNull ThrowingConsumer<T,?> consumer, @NotNull @NotNull String name)
consumer - the ThrowingConsumer instancename - the name to associate with the consumerNullPointerException - if either consumer or name is nullCopyright © 2023. All rights reserved.