What is Intermediate and Terminal Operations ?

Ans:- stream will perform the following operations:-

1.Intermediate operations
2.Terminal operations

1.Intermediate operations:- the operations which are performed in b/w streams of objects are known as Intermediate operations.

a. filter()
b.map()
c.sorted()
d.distinct()
e.peek()

2.Terminal operations:- the operations which are performed at the end of stream are known as Terminal operations

=> The following are some important Terminal operations.

a. forEach()
b. collect()
c. reduce()
d. count()
e. anyMatch(),allMatch(),noneMatch()
f. findAny(),findFirst()

*********************************************

Leave a Reply

Your email address will not be published. Required fields are marked *

*