When you have an ->
the javac compiler adds a static method with the contents of the code. It also adds dynamic call side information to the class so the JVM can map the interface the lambda implements to the arguments and return type. The JVM generates code at runtime to bind the interface to the generated method.
A difference with lambdas and anonymous classes is that implict variables only need to be effectively final (as in could have been made final) and member variables are copied i.e. it doesn't keep a reference to the this
of an outer class.
It can tell the difference between Runnable
and Callable
even though both take no arguments. For more details http://vanillajava.blogspot.com/2014/09/lambdas-and-side-effects.html