Skip to content
Advertisement

How would I turn this lambda function to a simple function?

I’m trying to understand lambda formatting in Java and could really use some help converting this function into a standard function to see how this works:

JavaScript

Advertisement

Answer

Start with the code to create an anonymous Callback object:

JavaScript

Then paste in the right hand side of the -> lambda operator as call()‘s method body. The only modification needed is to make it a return statement:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement