不接受任何内容也不返回任何内容的函数接口[重复]

2024-06-20

JDK中是否有一个标准的函数式接口,不接受也不返回任何内容?我找不到一个。像下面这样:

@FunctionalInterface
interface Action {
  void execute();
}

可运行怎么样:

@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();
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

不接受任何内容也不返回任何内容的函数接口[重复] 的相关文章

随机推荐