lambda()的含义 - > Java中的{} [英] Meaning of lambda () -> { } in Java

查看:109
本文介绍了lambda()的含义 - > Java中的{}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看以下Stack Overflow答案:
如何在运行时更改Spring的@Scheduled fixedDelay

I am looking at the following Stack Overflow answer: How to change Spring's @Scheduled fixedDelay at runtime

在代码中有以下行:

schedulerFuture = taskScheduler.schedule(() -> { }, this);

我想知道lambda () - > {} 表示该代码。我需要在不使用lambdas的情况下编写它。

I would like to know what the lambda () -> {} means in that code. I need to write it without using lambdas.

推荐答案

它的 Runnable ,空运行定义。这个的匿名类表示如下:

Its a Runnable with an empty run definition. The anonymous class representation of this would be:

new Runnable() {
     @Override public void run() {
          // could have done something here
     }
}

这篇关于lambda()的含义 - > Java中的{}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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