About Question enthuware.ocpjp.i.v11.2.3086 :

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

Moderator: admin

Post Reply
Artuwok
Posts: 7
Joined: Tue Aug 20, 2019 1:32 am
Contact:

About Question enthuware.ocpjp.i.v11.2.3086 :

Post by Artuwok »

Hi! I don't get this part
events.forEach( (k, v)->processEvents(v));
The lambda expression being passed to forEach is syntactically correct. However, the type of v is Object and there is no processEvents method available that can accept an Object.

Why v is Object?

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.i.v11.2.3086 :

Post by admin »

Type of v is Object because the type of "events" is non-generic Map (i.e. without any generic type applied to it) and therefore Map's key and value are Object and Object respectively.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests