About Question enthuware.ocpjp.v8.2.1872 :

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

Moderator: admin

Post Reply
crazymind
Posts: 85
Joined: Mon Dec 24, 2018 6:24 pm
Contact:

About Question enthuware.ocpjp.v8.2.1872 :

Post by crazymind »

In solution of question 33, it says
"Manipulating a stream doesn't manipulate the backing source of the stream. "
But why does setPrice change the original list? Thanks

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

Re: About Question enthuware.ocpjp.v8.2.1872 :

Post by admin »

Stream and an object in that stream are two different things. New stream doesn't contain clones of the objects in the original stream.

robhun79
Posts: 9
Joined: Thu Feb 02, 2023 12:18 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1872 :

Post by robhun79 »

I thought that this would throw an exception at runtime because we are calling a terminal operation twice on the same stream but am i correct now in thinking that this is two streams because by calling books.stream() for the second time we are getting a different stream? Thanks!

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

Re: About Question enthuware.ocpjp.v8.2.1872 :

Post by admin »

That is correct.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 5 guests