0 votes
in JAVA by (19.8k points)
What distinguishes Stream's Intermediate and Terminal Operations?

1 Answer

0 votes
by (19.8k points)
All stream operations fall into one of two categories: Terminal or Intermediate. The operations known as intermediate operations are those that release the stream so that subsequent operations can be performed on it. Lazy operations are intermediate operations since they do not analyze the Stream at the call point.

When a terminal operation is performed, these activities (Intermediate Operations) process data. Map and filter are two examples of intermediate operations.

Processing of Streams is started by Terminal Operations. The Stream runs through all of the Intermediate processes during this call. Sum, Collect, and forEach are some examples of terminal operations.

Related questions