Quantcast
Channel: User Federico klez Culloca - Stack Overflow
Viewing all articles
Browse latest Browse all 502

Answer by Federico klez Culloca for Terminal operations on streams cannot be chained?

$
0
0

Because

  1. Assuming you meant collect(Collectors.toList()), forEach is a List operation, not a Stream operation. Perhaps the source of your confusion: there is a forEach method on Stream as well, but that's not what you're using.
  2. 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.

Viewing all articles
Browse latest Browse all 502

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>