Are Java 8 lambdas compiled as inner classes, methods or something else? [duplicate]
The expression itself, assuming you pass an actual lambda expression and not a method reference, is compiled as a separate, synthetic method. In addition to any formal arguments to the expected functional interface (e.g., a single String in the case of Consumer<String>), it will include arguments for any captured values. At the code location where … Read more