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

Popular posts from this blog

How to create React project using command prompt?

How to achieve abstraction?

Interview Question? How to find square of each element in this Array {2,4,5,6,8} using map ?