Modifier and Type | Field and Description |
---|---|
static Runnable |
NOP
A
Runnable that does simply nothing. |
Modifier and Type | Method and Description |
---|---|
static <EX extends RuntimeException> |
asRunnable(RunnableWhichThrows<EX> delegate)
Converts a
RunnableWhichThrows into a Runnable , which is possible iff the source runnable's
exception is a subclass of RuntimeException . |
static <EX extends Throwable> |
asRunnableWhichThrows(Runnable delegate)
Converts a
Runnable into a RunnableWhichThrows . |
static <EX extends Throwable> |
ignoreExceptions(Class<EX> exceptionClass,
RunnableWhichThrows<EX> delegate)
Wraps the delegate such that its declared exception is caught and ignored.
|
static <EX extends Throwable> |
runSequentially(Collection<RunnableWhichThrows<EX>> delegates)
Runs the given delegates in the current thread, in the order of the collection's iterator.
|
static <EX extends Throwable> |
runSequentially(RunnableWhichThrows<EX> delegate1,
RunnableWhichThrows<EX> delegate2)
Runs delegate1, then delegate2 in the current thread.
|
static <ST> Runnable |
sparingRunnable(Runnable delegate,
Predicate<? super ST> condition,
ST subject)
The returned
Runnable runs the delegate iff the condition evaluates to true . |
static Runnable |
sparingRunnable(Runnable delegate,
Producer<? extends Boolean> condition)
The returned
Runnable runs the delegate iff the condition produces Boolean.TRUE . |
static <EX extends Throwable> |
swapIf(boolean swap,
RunnableWhichThrows<EX> runnable1,
RunnableWhichThrows<EX> runnable2)
Runs runnable1 and then runnable2, unless swap is
true , when the
running order is swapped (runnable2, then runnable1). |
public static <EX extends Throwable> RunnableWhichThrows<EX> runSequentially(RunnableWhichThrows<EX> delegate1, RunnableWhichThrows<EX> delegate2)
RunnableWhichThrows.run()
public static <EX extends Throwable> RunnableWhichThrows<EX> runSequentially(Collection<RunnableWhichThrows<EX>> delegates)
RunnableWhichThrows.run()
public static <EX extends RuntimeException> Runnable asRunnable(RunnableWhichThrows<EX> delegate)
RunnableWhichThrows
into a Runnable
, which is possible iff the source runnable's
exception is a subclass of RuntimeException
.EX
- The source runnable's exceptionpublic static <EX extends Throwable> RunnableWhichThrows<EX> asRunnableWhichThrows(Runnable delegate)
Runnable
into a RunnableWhichThrows
.public static <ST> Runnable sparingRunnable(Runnable delegate, Predicate<? super ST> condition, ST subject)
Runnable
runs the delegate iff the condition evaluates to true
.
(The condition is evaluated with null
as the subject argument.)
subject
- The subject for the conditionpublic static Runnable sparingRunnable(Runnable delegate, Producer<? extends Boolean> condition)
Runnable
runs the delegate iff the condition produces Boolean.TRUE
.public static <EX extends Throwable> void swapIf(boolean swap, RunnableWhichThrows<EX> runnable1, RunnableWhichThrows<EX> runnable2) throws EX extends Throwable
true
, when the
running order is swapped (runnable2, then runnable1).EX extends Throwable
public static <EX extends Throwable> Runnable ignoreExceptions(Class<EX> exceptionClass, RunnableWhichThrows<EX> delegate)
Copyright © 2018 Arno Unkrig. All rights reserved.