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

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
Sergiy Romankov
Posts: 31
Joined: Thu Feb 19, 2015 8:25 am
Contact:

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

Post 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);

liugengyu
Posts: 8
Joined: Thu Jul 09, 2020 4:09 pm
Contact:

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

Post 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);
...
}

Post Reply

Who is online

Users browsing this forum: No registered users and 111 guests