Meaning of lambda () -> { } in Java

Aliuk :

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

And in the code there is the following line:

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

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

Naman :

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
     }
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=35199&siteId=1