P - parameter type@FunctionalInterface
public interface Procedure1<P>
extends java.util.function.Consumer<P>
Consumer,
but in a more extensible way.
As it is extending Consumer it can be used anywhere a Consumer is expected.Procedure0,
Procedure2,
Procedure3,
Procedure4,
Procedure5,
Procedure6,
Procedure7,
Procedure8,
Procedure9| Modifier and Type | Field and Description |
|---|---|
static Procedure1<?> |
NULL
Procedure with one argument which does nothing.
|
| Modifier and Type | Method and Description |
|---|---|
default void |
apply(P arg)
Run the function.
|
default void |
applyNonNull(P argument)
Apply this procedure only if the argument is not
null. |
static <T> Procedure1<T> |
empty()
Return a procedure which does nothing.
|
static <T> Procedure1<T> |
from(java.util.function.Consumer<T> consumer)
Make a
Consumer usable as a Procedure1. |
static <E extends java.lang.Exception,PP> |
nonFragile(FragileProcedure1<E,? super PP> fragileProc)
Convert a 1-argument procedure which might throw a checked exception into
one which does throw an unchecked exception.
|
static <E extends java.lang.Exception,PP> |
nonFragileX(FragileProcedure1<E,? super PP> fragileProc,
java.util.function.BiConsumer<? super E,? super PP> exceptionHandler)
Convert a 1-argument procedure which might throw a checked exception into
one for which you can decide what happens with the exception.
|
default Procedure0 |
partial(P argument)
Return a partial evaluation of this procedure.
|
@NotNull static final Procedure1<?> NULL
empty() instead.default void apply(P arg)
arg - function argumentdefault void applyNonNull(@Nullable P argument)
null.
Using this invocation it is guaranteed that apply(Object) will always be called with
a non-null argument.
Use Types.notNull(Object, Object) if yo want to invoke this
with a default argument when argument is null.
argument - argument of this function, possibly null@NotNull default Procedure0 partial(P argument)
argument - constant argument use for the evaluation@NotNull static <T> Procedure1<T> from(@NotNull java.util.function.Consumer<T> consumer)
Consumer usable as a Procedure1.T - argument type of bothconsumer - consumerProcedure1 view of the given consumer@NotNull static <T> Procedure1<T> empty()
NULL, but the compiler will accept it smoothly.T - argument type@NotNull static <E extends java.lang.Exception,PP> Procedure1<PP> nonFragile(@NotNull FragileProcedure1<E,? super PP> fragileProc)
WrappedFragileException for any
checked exception thrown during apply(Object).E - exception typePP - parameter typefragileProc - procedure throwing a checked exception@NotNull static <E extends java.lang.Exception,PP> Procedure1<PP> nonFragileX(@NotNull FragileProcedure1<E,? super PP> fragileProc, @NotNull java.util.function.BiConsumer<? super E,? super PP> exceptionHandler)
nonFragile(FragileProcedure1))E - exception typePP - parameter typefragileProc - procedure throwing a checked exceptionexceptionHandler - exception handler. Its return value will be used as return value of the returned function.