What is stream API, why is it needed?
Ans :- stream is an interface from java.util.stream package which supports stream of objects,which means continuous flow of objects.
Stream<T> will perform the following operations:-
a. Intermediate operations
b.Terminal operations
1.Functional programming Paradigm:-
The Stream API supports functional programming paradigm, allowing developers to express operations on data in a concise and expressive manner.
2.Parallelism:- The stream API supports parallel processing, making it easier to take advantage of multi-core processors .Parallel stream can be created to process elements concurrently.
3.Code Readability:- Using the Stream API often leads to more readable and maintainable code.
4.Efficient Operations:- Stream operations, such as map, filter, and reduce, are designed to be efficient.
Leave a Reply