Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

functional interface that takes nothing and returns nothing [duplicate]

People also ask

Which functional interface does not take any input and returns an output?

Supplier The Supplier functional interface is also a type of functional interface that does not take any input or argument and yet returns a single output. This type of functional interface is generally used in the lazy generation of values.

Which functional interface would you use for the following no parameters returns a value?

IntConsumer functional interface represents an operation that accepts a single int-valued argument and returns no result.


How about Runnable :

@FunctionalInterface
public interface Runnable {
    /**
     * When an object implementing interface <code>Runnable</code> is used
     * to create a thread, starting the thread causes the object's
     * <code>run</code> method to be called in that separately executing
     * thread.
     * <p>
     * The general contract of the method <code>run</code> is that it may
     * take any action whatsoever.
     *
     * @see     java.lang.Thread#run()
     */
    public abstract void run();
}