Page 1 of 1

About Question enthuware.ocpjp.ii.v11.2.1854 :

Posted: Sat Jan 18, 2020 1:32 pm
by Sergiy Romankov
I am not sure. In some cases by writing Lamda I have to directly write type(s)
but here it is just
Doer d = (a, b)->b.substring(0, a);

why not

Doer<Integer, String> d = (a, b)->b.substring(0, a);

Re: About Question enthuware.ocpjp.ii.v11.2.1854 :

Posted: Wed Aug 26, 2020 9:17 am
by liugengyu
Because Interface Doer is not like Function<T,R> in JDK, which already has generics.
public interface Function<T, R> {

R apply(T t);
...
}