top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is difference between intermediate operations and terminal operations of Java 8’s stream API?

0 votes
471 views
What is difference between intermediate operations and terminal operations of Java 8’s stream API?
posted Nov 30, 2017 by Ammy Jack

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

STREAM INTERMEDIATE OPERATIONS

  1. Stream Intermediate operations are not evaluated until we chain it with Stream Terminal Operation.
  2. The output of Intermediate Operations is another Stream.
  3. Intermediate Operations are evaluated Lazily.
  4. We can chain any number of Stream Intermediate Operations.
  5. We can use any number of Stream Intermediate Operations per Statement.

STREAM TERMINAL OPERATIONS
1. Stream Terminal Operations are evaluated on it’s own. No need other operations help.
2. The output of Intermediate Operations is Not a Stream. Something else other than a Stream.
3. Terminal Operations are evaluated Eagerly.
4. We can NOT chain Stream Terminal Operations.
5. We can use only one Stream Terminal Operation per Statement.

answer Dec 1, 2017 by Jon Deck
...