I was reading about
Java 8 Lambda Expressions and I understood what it is, its syntax and where to use it.
Now I understand what is a functional interface and how we can refactor code using anonymous inner class to code using Lambda Expressions.
Consider this code
In case of Anonymous classes
we create an instance of anonymous class implementing Runnable interface
But by seeing this code it look like we are assigning a function to Runnable, is it that under the hood an anonymous class implementing Runnable interface is created. Or something else.
Its hard to digest that we are assigning a lambda expression to some interface type. One is a interface and other one a lambda expression. Under the hood something must be happening .
If somebody can explain it and save me some of my black hairs from becoming white.
Tea Addict, Oracle Java Programmer , Oracle SQL Expert , Oracle Java Web Component Developer, Oracle Web Service Developer