Lets assume that we have the following code:
Thread t = new Thread(new Runnable(){
public void run(){
System.out.println("separated thread");
}
});
t.start();
The replaceable of the above in Java 8 is:
Thread t = new Thread(() -> System.out.println("separated thread"));
t.start();
Now as far as I know lambda expression in other languages that runs on the JVM for example Scala and Groovy, is simply treated as an anonymous block of code where the compiler replaces the expression with its equivalent anonymous inner class resulting a new class for each call, i know for a fact that the above is not good at all in term of size and runtime.
Is this the case in Java? if not how does it deal with lambda (in details)? I would also appreciate; if the mechanism behind using invokedDynamic feature to supports lambda is explained?