#98 Stream API in Java

preview_player
Показать описание
Check out our courses:

Coupon: TELUSKO10 (10% Discount)

Udemy Courses:

For More Queries WhatsApp or Call on : +919008963671

In this lecture we will learn:
- What is a stream?
- Methods present inside the stream interface
- Filter, Map and Reduce methods of stream
- Use of methods in Big Data

#1
- Stream is an interface, it contains a stream() method.
- Stream method return an object of type stream.
- Any operation can be performed inside the stream method.
- Any changes done inside the stream can be reflected on the actual list.
- Once we work with a stream, we can't reuse it. We can work with a stream only once.

#2
- Stream provides a lot of methods to work upon.
- filter() method returns a new Stream that contains the value which satisfies the given condition. The filter method is used to select elements as per the Predicate passed as an argument.
- map() takes each value and performs operations on it. It returns a stream consisting of the results of applying the given function to the elements of this stream.
- reduce() method does not return the stream but it gives the value of a type that you defined in the stream. It is used to reduce the elements of a stream to a single value.
The reduce method takes a BinaryOperator as a parameter.

#3
- If you want to use Big Data, then first you have to apply a filter on it to separate useful data.
- After applying a filter, you need to transform it into the required data with the help of a map.
- And the graph of it, can be made with the help of the reduce method.
- We can reduce the code by applying methods one after the other.

More Learning :

Donation:
PayPal Id : navinreddy20
Рекомендации по теме
Комментарии
Автор

I often think is java invented by Naveen sir, U r class is amazing.❤

limitless
Автор

Greets from Germany. And thanks, I can actually using this for my computer science exam in next weeks :D

Flo-mzct
Автор

"It's not difficult, it's just unfamiliar"

chinmayrath
Автор

Thank you for this amazing video. And the last statement hit me really hard. "It's not difficult, it's just unfamiliar" which is absolutely true. There is a famous saying in Kannada, "until you learn and master something, it always feels like Brahma vidhya(difficult task), once you learn it and master it, it feels like koothi-vidhya(simple thing) so moral here is, it feels only difficult until you learn it. Once you learn it it always feels simple. So learn it and make it familiar so you don't feel it as difficult.

krishnabangari
Автор

thank u so much....i like to watch your video million times❤❤❤huge respect from Nepal🇳🇵🇮🇳

milankbudha
Автор

bro here we need to use class method ?? only or can we use function also ??

mohanj
Автор

Thanks for amazing video, I am from Myanmar ❤❤

MoeMoe-qrod
Автор

How to use stream multiple times ?I have one requirement where my method is streaming elements again, on second time it gives null

harshitsachdeva
Автор

Hello Naveen garu, do you take any instructor led training classes? If yes, I'd like to join

manishdeshpande
Автор

Sir i we set specific to specific element value.

For example 7 is element.
I want to get 14 instead of 7

devabdul
Автор

It's not difficult, it's just unfamiliar, It's 💯 true. And I am at the end of the playlist. Thank you Navin sir for this amazing playlist.

yashaswinihm
Автор

java: bad operand types for binary operator '+' ---> the error is there when I type, int result = s3.reduce(0, (c, e)-> c+e);

_ankanamajee
Автор

One of my favourite trainers said, it's not difficult but a little confusing. PS: you are one of my fav teachers. Mr. Navin.❤

sakthipriya