Because
- Assuming you meant
collect(Collectors.toList())
,forEach
is aList
operation, not aStream
operation. Perhaps the source of your confusion: there is aforEach
method onStream
as well, but that's not what you're using. - Even if it weren't, nothing stops you from creating another stream from something that can be streamed, you just can't use the same stream you created in the first place.