标签:col ast png jdk public ima dem ati sys
demo1:
public class ConstructorRefTest { public static void main(String[] args) { // lambda Supplier<Person> supplier = ()-> new Person(); // 构造器引用 Supplier<Person> supplier2 = Person::new; } }
demo2:
public class ConstructorRefTest { public static void main(String[] args) { // lambda Function<String, Person> func1 = str -> new Person(str); System.out.println(func1.apply("master shi")); // 构造器引用 Function<String, Person> func2 = Person::new; System.out.println(func2.apply("master yi")); } }
标签:col ast png jdk public ima dem ati sys
原文地址:https://www.cnblogs.com/dayanjing/p/14887387.html