Thanks.. Instead of using employees. ParallelStream() we can also use employees.stream().parallel () , both of them are producing execution from parallel stream.
At 1:27 you said that sequential stream uses multiple threads but single core, but at 8:27 you can see only 1 thread is used by sequential stream. Can you please explain about this more ?
Awesome video. I come to know a lot of thing from this video. But here is a question, what if you call parallel stream first and then normal stream in the same program. The execution time shows otherwise .
@@Javatechie please specify how it work. if parallel processing is done first and after sequential stream then parallel is taking very much time than sequential.
Hey, Good video tutorials, but can you describe the pros and cons of using serial and parallel streams. It will be good if you can also say when to use these streams and why.
In begin I already mentioned Whenever you doesn't care for order of execution you should go for pareallstrem for example retrieve data from DB But it's always recommend to use write operation using parallstream if your data associated with other dependant entity or model
Thank you so much sir! A very useful video❤. I need one help. In my case the execution time for parallel stream is more than that of normal stream. Could you please help me here with the reasoning?
I want to see the results by swapping code position..like firstly i will print parallel stream code block followed by normal stream and then see the difference
What happens when for certain code one's output will be input for next code to be executed . Even though multiple threads which is equivalent to multiple cores it has to be a serial execution.
Hii... I have 3 queried need to run asyn....and need to wait for the results to store in list.... Then after 3 tasks done... I need to proceed further running the remaining code.... In this scenario...could anyone suggest which is better to use... I tried executor service...but it is going sync...not waiting for the threads to complete.... Thanks in advance
example does not seems to be correct, just flip the code and use parallel stream first and then use sequential stream you will see the sequential one takes less time than parallel one.
Using all CPU cores is not advisable and it's noticed CPU usage reaches more than threshold. For personal RND this is ok but not on Production environment. Example to calculate average using parallelstream is not making any sense.
Could someone be so kind to explain me why at my computer, Plain stream took time : 3 but Parallel stream took time : 6. Parallel stream took more time than Plain stream.
* Code is not formatted correctly, inconsistent spaces * One per line, every (.) and operation should come to the next line * Use `Instant` java.time class for start and end and use `Duration` to measure time between them (I know you are not aiming for these things in this example, this is for new developers)
Thanks.. Instead of using employees. ParallelStream() we can also use employees.stream().parallel () , both of them are producing execution from parallel stream.
Yes
Great way to explain, concept was made clear that’s what matters
Your way of explanation is really nice and clear
I really feel the response time today after using this..
Thank you very much for all the hard work you put for people like me
Thanks for all the efforts. ❤️ Keep making videos
greatjob keep it up. You are going step by step respect for it
Wow man... Awesome tutorial.. All the best !!
At 1:27 you said that sequential stream uses multiple threads but single core, but at 8:27 you can see only 1 thread is used by sequential stream. Can you please explain about this more ?
Please make more videos on interview questions.
Love your work.
Waaw...There are 4 brilliants who didn't like this video.....
This is exceptional!
love your channel. thanks for all your hard work.
Awesome video. I come to know a lot of thing from this video. But here is a question, what if you call parallel stream first and then normal stream in the same program. The execution time shows otherwise .
Purpose is different
@@Javatechie please specify how it work. if parallel processing is done first and after sequential stream then parallel is taking very much time than sequential.
I read some of article regarding, like benchmarking in java, but didn't understood much 😢😢😢😢😢
Genious on RUclips
Thank you so much. Very nicely explained.
It's nice tutorial bro .Keep rocking always
You make it so simple. #JavaTechieUniversity
Hey, Good video tutorials, but can you describe the pros and cons of using serial and parallel streams. It will be good if you can also say when to use these streams and why.
In begin I already mentioned
Whenever you doesn't care for order of execution you should go for pareallstrem for example retrieve data from DB
But it's always recommend to use write operation using parallstream if your data associated with other dependant entity or model
@@Javatechie I think you are suggesting to use serial stream to write operation if the data is dependent on other entities/models. Right?
Yes
@@Javatechie Thanks
Thank you so much sir! A very useful video❤. I need one help. In my case the execution time for parallel stream is more than that of normal stream. Could you please help me here with the reasoning?
Is it an IO intensive task or CPU intensive task?
@@Javatechie Thanks for the response. I believe it is a CPU-intensive task because I tried with the same code you used in the video.
Super!!! Thanks for this video.
Thank you brother, clear explanation..
Very well explained Sir.. thanks
Very well explained
Very simple explanation
Thanks. Please post lot of interview questions.
Superb man, Thanks
Very well mate!
Great work buddy... Can you please made one video on Saga pattern in microservices
Super informative.
very good bro!!! thanks!!
thanks for the nice explanation
Nice content
Awesome explanation..
Good explanation
I want to see the results by swapping code position..like firstly i will print parallel stream code block followed by normal stream and then see the difference
Thank you.
What happens when for certain code one's output will be input for next code to be executed . Even though multiple threads which is equivalent to multiple cores it has to be a serial execution.
tnkx, good video
bravo, thanks sir
tq @Java Techie
Thanks, I am wondering how to control exceptions in stream?
I will cover that part don't worry
How can we try with arraylist as input and work on parallel
List.parallelStream() will help you
Is there any way to keep the ordering but running in parallel . In your example you loose the ordering in the parallel execution
In parallel we can't control order of execution
Thanks for the video
Thank you very much for the videos, are you working in any it industry
Yes 😜
@@Javatechie is there any way to contact you for any queries related to java topics in future
javatechie4u@gmail.com
Please add all these in a playlist
Please checkout my java 8 playlist
Thanks man
thank you!!
Hii...
I have 3 queried need to run asyn....and need to wait for the results to store in list....
Then after 3 tasks done...
I need to proceed further running the remaining code....
In this scenario...could anyone suggest which is better to use...
I tried executor service...but it is going sync...not waiting for the threads to complete....
Thanks in advance
Normal stream will be executed by same core???
Yes exactly
Java8 playlist (www.youtube.com/watch?v=zp2tq...) shows spring boot tutorial
example does not seems to be correct, just flip the code and use parallel stream first and then use sequential stream you will see the sequential one takes less time than parallel one.
Thanks Anupam , will check and update
How can we handle if any thread is failing into it ?
sir ek vedio IntelliJ IDEA espe bana dejeye kaise install kare and kaise spring boot ke stah configure kare please
Okay I will
@@Javatechie thank you so much sir
You have share spring boot playlist instead of java 8.
Using all CPU cores is not advisable and it's noticed CPU usage reaches more than threshold. For personal RND this is ok but not on Production environment. Example to calculate average using parallelstream is not making any sense.
How it will works internally ?
Please check second example where I log about worker thread
Could someone be so kind to explain me why at my computer, Plain stream took time : 3 but Parallel stream took time : 6. Parallel stream took more time than Plain stream.
same problem with me
Please try to run it couple of times and do the bench marking to figure it out
Please explain Linux tutorial and also design pattens
* Code is not formatted correctly, inconsistent spaces
* One per line, every (.) and operation should come to the next line
* Use `Instant` java.time class for start and end and use `Duration` to measure time between them
(I know you are not aiming for these things in this example, this is for new developers)