Package zone.lamprey.function
Interface Runnable
- All Superinterfaces:
Runnable
- 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 Runnable extends Runnable
This is a functional interface that accepts nothing and returns nothing.
-
Method Summary
Modifier and Type Method Description default <T, F extends Supplier<T>>
FandThen(F after)LikeandThen(Runnable), but creates a Supplier.default RunnableandThen(Runnable after)Returns a composedRunnablethat performs, in sequence, this operation followed by theafteroperation.default Runnableforever()default RunnableloopFor(int times)voidrun()default RunnablewhileTrue(BooleanSupplier terminationCondition)
-
Method Details
-
run
void run()- Specified by:
runin interfaceRunnable- See Also:
Runnable.run()
-
andThen
Returns a composedRunnablethat performs, in sequence, this operation followed by theafteroperation. If performing either operation throws an exception, it is relayed to the caller of the composed operation. If performing this operation throws an exception, theafteroperation will not be performed.- Parameters:
after- the operation to perform after this operation- Returns:
- a composed
Runnablethat performs in sequence this operation followed by theafteroperation - Throws:
NullPointerException- ifafteris null
-
andThen
LikeandThen(Runnable), but creates a Supplier.- Type Parameters:
T- The type to return.F- The type of supplier to chain.- Parameters:
after- the operation to perform after this operation- Returns:
- a composed
Runnablethat performs in sequence this operation followed by theafteroperation
-
andThen
LikeandThen(Runnable), but creates a Consumer.- Type Parameters:
T- The type to accept.F- The type of consumer to chain.- Parameters:
after- the operation to perform after this operation- Returns:
- a composed
Runnablethat performs in sequence this operation followed by theafteroperation
-
andThen
LikeandThen(Runnable), but creates a BiConsumer.- Type Parameters:
T- The first type to accept.U- The second type to accept.F- The type of BiConsumer to chain.- Parameters:
after- the operation to perform after this operation- Returns:
- a composed
Runnablethat performs in sequence this operation followed by theafteroperation
-
andThen
LikeandThen(Runnable), but creates a TriConsumer.- Type Parameters:
T- The first type to accept.U- The second type to accept.V- The third type to accept.F- The type of TriConsumer to chain.- Parameters:
after- the operation to perform after this operation- Returns:
- a composed
Runnablethat performs in sequence this operation followed by theafteroperation
-
andThen
LikeandThen(Runnable), but creates a Function.- Type Parameters:
T- The type to accept.F- The type of function to chain.R- The type returned by the after function.- Parameters:
after- the operation to perform after this operation- Returns:
- a composed
Runnablethat performs in sequence this operation followed by theafteroperation
-
andThen
LikeandThen(Runnable), but creates a BiFunction.- Type Parameters:
F- The type of function to chain.T- The first type to accept.U- The second type to accept.R- The return type of the after function.- Parameters:
after- the operation to perform after this operation- Returns:
- a composed
Runnablethat performs in sequence this operation followed by theafteroperation
-
andThen
LikeandThen(Runnable), but creates a TriFunction.- Type Parameters:
F- The type of TriFunction to chain.T- The first type to apply.U- The second type to apply.V- The third type to apply.R- The return type of the chained function.- Parameters:
after- the operation to perform after this operation- Returns:
- a composed
Runnablethat performs in sequence this operation followed by theafteroperation
-
forever
- Returns:
- A version of this Runnable that calls the
run()method repeatedly forever. This will never terminate unexceptionally.
-
loopFor
- Parameters:
times- The number of times to loop.- Returns:
- A version of this Runnable that calls the
run()method a given number of times
-
whileTrue
-