Java 8 functional interface with no arguments and no return value(Java 8 函数式接口,无参数,无返回值)
问题描述
Java 8 函数式接口对于什么都不接受也不返回什么的方法是什么?
What is the Java 8 functional interface for a method that takes nothing and returns nothing?
即,等效于 C# 无参数 Action
与 void
返回类型?
I.e., the equivalent to to the C# parameterless Action
with void
return type?
推荐答案
如果我理解正确,你想要一个带有方法 void m()
的函数式接口.在这种情况下,您可以简单地使用 Runnable
一个>.
If I understand correctly you want a functional interface with a method void m()
. In which case you can simply use a Runnable
.
这篇关于Java 8 函数式接口,无参数,无返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!