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?
About Question enthuware.ocpjp.v8.2.1850 :
Moderator: admin
-
- Posts: 66
- Joined: Mon Feb 20, 2017 12:31 pm
- Contact:
-
- Posts: 66
- Joined: Mon Feb 20, 2017 12:31 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1850 :
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:
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.
-
- Site Admin
- Posts: 10046
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1850 :
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.
Who is online
Users browsing this forum: No registered users and 83 guests