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);
About Question enthuware.ocpjp.ii.v11.2.1854 :
Moderator: admin
-
- Posts: 31
- Joined: Thu Feb 19, 2015 8:25 am
- Contact:
-
- Posts: 8
- Joined: Thu Jul 09, 2020 4:09 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.1854 :
Because Interface Doer is not like Function<T,R> in JDK, which already has generics.
public interface Function<T, R> {
R apply(T t);
...
}
public interface Function<T, R> {
R apply(T t);
...
}
Who is online
Users browsing this forum: No registered users and 111 guests