Meaning of lambda () -> { } in Java

  • A+
Category:Languages

I am looking at the following StackOverflow 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 do the lambda () -> {} means in that code. I need to write the same without using lambdas.

 


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

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

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: