Page 1 of 1

About Question enthuware.ocpjp.v8.2.1850 :

Posted: Fri Oct 23, 2020 3:50 pm
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?

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

Posted: Sat Oct 24, 2020 1:39 pm
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.

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

Posted: Sun Oct 25, 2020 5:18 am
by admin
You are changing the property of an object of a Stream. Not the stream itself.