(String[] args)
| 5 | public class LambdaConstructor { |
| 6 | |
| 7 | public static void main(String[] args) { |
| 8 | Supplier<A> noArg = A::new; |
| 9 | A a1 = noArg.get(); |
| 10 | B b1 = a1.b; |
| 11 | use(b1); |
| 12 | |
| 13 | Function<B, A> oneArg = A::new; |
| 14 | A a2 = oneArg.apply(b1()); |
| 15 | B b2 = a2.b; |
| 16 | use(b2); |
| 17 | |
| 18 | BiFunction<B, B, A> twoArgs = A::new; |
| 19 | A a3 = twoArgs.apply(b2(), b3()); |
| 20 | B b3 = a3.b; |
| 21 | use(b3); |
| 22 | } |
| 23 | |
| 24 | static B b1() { |
| 25 | return new B(); |