Java 8 函数式接口,无参数,无返回值 [英] Java 8 functional interface with no arguments and no return value

查看:32
本文介绍了Java 8 函数式接口,无参数,无返回值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java 8 函数式接口对于什么都不接受也不返回什么的方法是什么?

What is the Java 8 functional interface for a method that takes nothing and returns nothing?

即,等效于 C# 无参数 Actionvoid 返回类型?

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 函数式接口,无参数,无返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆