I was wondering recently as Runnable is very often used in a functional context. At the same time according to javadoc its semantical meaning is very close to multithreading while it is not aways used in such context:
The Runnable interface should be implemented by any class whose instances are intended to be executed by a thread. The class must define a method of no arguments called run. This interface is designed to provide a common protocol for objects that wish to execute code while they are active. For example, Runnable is implemented by class Thread. Being active simply means that a thread has been started and has not yet been stopped.
Is Runnable
equivalent to Supplier<Void>
? Or is Runnable
equivalent to Function<Void,Void>
and why is it not Supplier then ? How does Runnable align with java.util.function
package's already present functional interfaces.