About Question enthuware.ocpjp.v8.2.1850 :

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

Moderator: admin

Post Reply
Javier
Posts: 66
Joined: Mon Feb 20, 2017 12:31 pm
Contact:

About Question enthuware.ocpjp.v8.2.1850 :

Post by Javier »

Hi Paul,
After working on this code, I see that streams don´t change the original collection object. Streams work on the object, but they are not able to change this original object. Am I right?

Javier
Posts: 66
Joined: Mon Feb 20, 2017 12:31 pm
Contact:

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

Post by Javier »

I just saw that streams can change the original collection object if the stream invoke a method able to change the object, like setter methods:
In another Enthuware question, enthuware.ocpjp.v8.2.1872:

Code: Select all

s.forEach(b->b.setPrice(10.0));// this setPrice will change the original object.

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

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

Post by admin »

You are changing the property of an object of a Stream. Not the stream itself.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 83 guests