Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public foo() { first = new T(); second = new T(); } //ERROR
- foo<String> f = foo.makeFoo(String::new)
- public static <T> foo<T> makeFoo(Supplier<T> constr)
- {
- return new foo<>(constr.get(), constr.get());
- }
- Error:(35, 38) java: method makeFoo in class generic.foo<T> cannot be applied to given types;
- required: java.util.function.Supplier<T>
- found: Integer::new
- reason: cannot infer type-variable(s) T
- (argument mismatch; incompatible parameter types in method reference)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement