Stream never modifies the source data, it processes it and gives us the result without modifying the original data.
Java: Beginner Guide to Stream API
a thread...
Stream never modifies the source data, it processes it and gives us the result without modifying the original data.
1. Collection. stream()
2. Stream.of(T... values)
3. Arrays. stream()
4. Stream.builder()
Eg:️

1. Intermediate Operations(IO)
2. Terminal Operations(TO)
Here's what the stream pipeline looks like:
Source -> Intermediate Operations -> Terminal Operations
It returns another stream object, after this, we can either call another IO or TO.
Few methods in Stream API for Intermediate operations:
1. filter()
2. map()
3. sorted()
and many more...
filter() - filters out the data based on any boolean condition - below we're filtering elements starting with the letter a.
map() - performs some given operation on the whole data set - below we're converting every element to upper case.

It's the last operation done on stream that's why it's called terminal.
This operation returns the final result.
Few methods in Stream API for Terminal operations:
1. collect()
2. count()
3. forEach()
and many more...
collect() - collects the elements in the given collection as shown below in the first case it is returning data in the form of a list.
count() - counts the no of the element in the stream and returns in the form of long.

More from Vikas Rajput
You May Also Like
Following @BAUDEGS I have experienced hateful and propagandist tweets time after time. I have been shocked that an academic community would be so reckless with their publications. So I did some research.
The question is:
Is this an official account for Bahcesehir Uni (Bau)?
Bahcesehir Uni, BAU has an official website https://t.co/ztzX6uj34V which links to their social media, leading to their Twitter account @Bahcesehir
BAU’s official Twitter account
BAU has many departments, which all have separate accounts. Nowhere among them did I find @BAUDEGS
@BAUOrganization @ApplyBAU @adayBAU @BAUAlumniCenter @bahcesehirfbe @baufens @CyprusBau @bauiisbf @bauglobal @bahcesehirebe @BAUintBatumi @BAUiletisim @BAUSaglik @bauebf @TIPBAU
Nowhere among them was @BAUDEGS to find
The question is:
Is this an official account for Bahcesehir Uni (Bau)?

Bahcesehir Uni, BAU has an official website https://t.co/ztzX6uj34V which links to their social media, leading to their Twitter account @Bahcesehir
BAU’s official Twitter account

BAU has many departments, which all have separate accounts. Nowhere among them did I find @BAUDEGS
@BAUOrganization @ApplyBAU @adayBAU @BAUAlumniCenter @bahcesehirfbe @baufens @CyprusBau @bauiisbf @bauglobal @bahcesehirebe @BAUintBatumi @BAUiletisim @BAUSaglik @bauebf @TIPBAU
Nowhere among them was @BAUDEGS to find
