Hi guys. I'm studying chapter 4 of ocp Study Guide by Jeanne and Scott and inspired in one exercise of page 201 I did another one to understand more how peek() works but I can't understand what's going on.
First of all I want to say that I noticed it by chance that if I add count() method at the end, the stream works as I expect, but my question is why?.
As you can see, now the output is [alex, anna, toby] but if I remove count() method, the result is , so neither element is added to the list.
Thank you guys, I'm really breaking my head trying to solve it but still nothing.