[HD-OCP17/21-Fundamentals Pg 0, Sec. 21.1.6 - quiz]

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

Moderator: admin

Post Reply
joaoclopes
Posts: 35
Joined: Mon Sep 23, 2024 4:49 pm
Contact:

[HD-OCP17/21-Fundamentals Pg 0, Sec. 21.1.6 - quiz]

Post by joaoclopes »

Hello,

On Q2, 2.
Since the limitmethod limits the incoming streams to at mostthe given number of elements and since the stream in this example contains only five elements, limit(10)will pass on all the five elements to the outgoing stream. However, one of the elements is greater than 70and so, noneMatch(i -> i>70);will return false.
In reality the limit(10) will pass only the first 4 elements to the stream right? Because the when it reaches the element "80" the noneMatch will return false.

Thanks,
João

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

Re: [HD-OCP17/21-Fundamentals Pg 0, Sec. 21.1.6 - quiz]

Post by admin »

That's right. From the perspective of the limit(10) method, it will not pass more than 10 elements to the next operation but since the noneMatch operation fails at the fourth element itself, only 4 elements will actually get passed. The explanation should make this point clear.

thank you for your feedback!

joaoclopes
Posts: 35
Joined: Mon Sep 23, 2024 4:49 pm
Contact:

Re: [HD-OCP17/21-Fundamentals Pg 0, Sec. 21.1.6 - quiz]

Post by joaoclopes »

No problem! Glad that I could help.

Post Reply

Who is online

Users browsing this forum: liigapaljuinfot and 46 guests