Use the method reference to express creating a new object. Let's assume that we have class A{}. Replace the following Supplier function declaration with another one that uses the method reference:
Supplier<A> supplier = () -> new A();
Use the method reference to express creating a new object. Let's assume that we have class A{}. Replace the following Supplier function declaration with another one that uses the method reference:
Supplier<A> supplier = () -> new A();
The answer is:
Supplier<A> supplier = A::new;