275 total views, 2 views today
Welcome to Java 8 series. In this post, you will learn about Java Stream terminal operations.
A terminal operation produces the final output. Stream pipeline will end with a single terminal operation such as foreach, count, collect, sum.
Once the terminal operation is applied to the stream, we cannot reuse the stream again. We have to create a new stream and create a new stream pipeline again from the source. So, the stream cannot be reused when a terminal operation is applied or invoked.
To put in a simpler way, Stream is considered consumed after a terminal operation is executed.
Every Terminal operation will end the stream and produces a result.
Below are the list of Terminal operations
In this post, we learned about Java Stream terminal operations.
Reference : Official documentation
Please leave a comment and give us a thumbs up!