explain the comparison with the example. can anyone explain to me the line from the book "java8 in Action" ---
every element in the collection has to be computed before it can be added to the collection.
explain the comparison with the example. can anyone explain to me the line from the book "java8 in Action" ---
every element in the collection has to be computed before it can be added to the collection.
I like the explanation from the book Java 8 in action, maybe it will help you too understand better the difference:
For readers who like philosophical viewpoints, you can see a stream as a set of values spread out in time. In contrast, a collection is a set of values spread out in space (here, computer memory), which all exist at a single point in time—and which you access using an iterator to access members inside a for-each loop.