0

Java creates a .class file per anonymous class (those classes named MyClass$1.class, MyClass$2.class..). In fact, Java applies the same for Lambda expressions. However, I don't see any generated class when I use a method reference in my code. How Java resolve them without creating an anonymous class?

Example:

    List<String> names = Arrays.asList("Java8", "Lambdas", "In", "Action");
    Stream<String> s = names.stream();
    s.forEach(System.out::println);
rpau
  • 41
  • 3
  • 1
    You should recheck what you say after “In fact”. Regarding class files, there is no difference between method references and lambda expression. *Neither* produces `.class` files…          See also [here](http://stackoverflow.com/a/26257532/2711488) – Holger Jul 09 '15 at 13:18
  • Ok, thanks! Sorry, I haven't found this question – rpau Jul 09 '15 at 13:39

0 Answers0