@MohitKandpal
1 of 1 posts
MohitKandpal
Stream: - It is an API introduced in Java 8 used to process a collection of objects. It primarily has two types of operations: -
It is a combination of one or more intermediate operations followed by a terminal operation. Each intermediate operation is lazily executed and returns a stream as a result, hence, various intermediate operations can be pipelined. Terminal operations mark the end of the stream and return the result.
Some common intermediate and terminal operations are as follows: -
JAVA1<R> Stream<R> map(Function<? super T, ? extends R> mapper)
1<R> Stream<R> map(Function<? super T, ? extends R> mapper)
JAVA1Stream<T> filter(Predicate<? super T> predicate)
1Stream<T> filter(Predicate<? super T> predicate)