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);
Aucun commentaire:
Enregistrer un commentaire