What is Intermediate and Terminal Operations ?

 Q. What is Intermediate and Terminal Operations ?

Ans:- stream<T> 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()


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


Comments