Java 8 Streams | map() and reduce() Example | JavaTechie

  Рет қаралды 94,713

Java Techie

Java Techie

3 жыл бұрын

This tutorial will guide you to understand java 8 stream api map-reduce concept with Realtime implementation
#javatechie #stream #java8
GitHub:
github.com/Java-Techie-jt/java8
Blogs:
/ javatechie
Facebook:
/ 919464521471923
guys if you like this video please do subscribe now and press the bell icon to not miss any update from Java Techie
Disclaimer/Policy:
--------------------------------
Note : All uploaded content in this channel is mine and its not copied from any community , you are free to use source code from above mentioned GitHub account

Пікірлер: 76
@akjoker79
@akjoker79 2 жыл бұрын
The examples used are simple , crisp and. clear
@rajeshchaurasia3609
@rajeshchaurasia3609 3 жыл бұрын
I enjoy all your videos. Excellent work sir
@Netalon
@Netalon 3 жыл бұрын
Very Nice content! Greetings from Brazil 🇧🇷
@Javatechie
@Javatechie 3 жыл бұрын
Glad to have viewers from Brazil
@parthec1
@parthec1 2 жыл бұрын
Very informative video,thanks for creating it,,
@learningjavawithme915
@learningjavawithme915 3 жыл бұрын
As always you are excellent sir
@qwarlockz8017
@qwarlockz8017 2 жыл бұрын
Thank you so much. I am finding your videos are the clearest I have seen on the subjects. It is truly a pleasure to learn from you.
@Javatechie
@Javatechie 2 жыл бұрын
Thanks qwarlock ☺️
@LearnWithKhurshid
@LearnWithKhurshid 3 жыл бұрын
Nicely explain video 👍
@AkanshaGrowArts
@AkanshaGrowArts Жыл бұрын
Thanks for the nice video sir.
@muralikrishna6044
@muralikrishna6044 7 ай бұрын
I love the way of elocution.. Gohead..
@amgadmohammed6358
@amgadmohammed6358 3 жыл бұрын
Wonderful
@maheshd3506
@maheshd3506 Жыл бұрын
Thanks for your clear explanation
@Srini8174
@Srini8174 3 жыл бұрын
Your content explanation always easy to understandable.Pls explain with explain on distributed transaction in micro services.
@pratishrutipanda6461
@pratishrutipanda6461 3 жыл бұрын
Nice video sir
@jayw8946
@jayw8946 3 жыл бұрын
great vedio
@yogendrasingh-nz3pw
@yogendrasingh-nz3pw 3 жыл бұрын
nyc explanation
@channabasavav1823
@channabasavav1823 2 жыл бұрын
Thank you Java Techie 🙏🙏
@JavaWithRahul
@JavaWithRahul Жыл бұрын
What a great tutorial
@aveshkadri
@aveshkadri 3 жыл бұрын
very helpful.
@rishikesharora8681
@rishikesharora8681 3 жыл бұрын
i got out from the interview just because i could not tell the reduce method with map....Now i wont get out for this topic at least 😍 at the end, its just a QUALITY CONTENT
@francksgenlecroyant
@francksgenlecroyant 2 жыл бұрын
Well done buddy!
@venkyyadav9527
@venkyyadav9527 2 жыл бұрын
Thank you so much. Your explanation always easy to understandable.
@Javatechie
@Javatechie 2 жыл бұрын
Keep learning buddy thank you 😊
@josephnairpudupermanil8679
@josephnairpudupermanil8679 2 жыл бұрын
Nice explanation
@prakrutijani4205
@prakrutijani4205 4 ай бұрын
Your content fan thankyou
@gasparcalix2095
@gasparcalix2095 Жыл бұрын
excelent!
@gdIndia199
@gdIndia199 2 жыл бұрын
great
@kishordige9721
@kishordige9721 Жыл бұрын
Thank you!
@paileemallesh9942
@paileemallesh9942 2 жыл бұрын
Thank you
@jenlopoz4990
@jenlopoz4990 2 жыл бұрын
subcriber from ph
@abanisahoo5926
@abanisahoo5926 3 жыл бұрын
Nicely explained!!!
@Mateo-cy7cc
@Mateo-cy7cc Жыл бұрын
Muchas gracias
@chetanbhandari3033
@chetanbhandari3033 3 жыл бұрын
Thanks basant wlc back..
@anukratsoni3940
@anukratsoni3940 3 жыл бұрын
Can you please tell me how to find particular char or non-repeating in the string like ThatForThats I have to find ''F" in this
@sreddy8141
@sreddy8141 2 жыл бұрын
Sir, we usually don't use getters seters explicitly mentioned right, like we go for lombok, if we have to have null check in getter methods , we can eliminate oly getter generation from lombok and have optional null check ? Or is there any way we have optimized way to do this?
@Javatechie
@Javatechie 2 жыл бұрын
Lombok is not recommended in prod environment
@sreddy8141
@sreddy8141 2 жыл бұрын
@@Javatechie thanks sir, i wasn't aware of this. Good to know this , will try to know the reason for it to have concrete details
@nick-sx2zn
@nick-sx2zn 3 жыл бұрын
Bro u have any videos related to method reference
@jayw8946
@jayw8946 3 жыл бұрын
Can you please make vedio on Intellij tricks tips
@prashanthdhn5216
@prashanthdhn5216 3 жыл бұрын
Hi Grate Techie ,could please upload rest api and Hibernate Jpa videos..🙏
@Javatechie
@Javatechie 3 жыл бұрын
It's already there please go to my channel and on right top corner you can see search tab Just search with key which you want
@malleswarrao3887
@malleswarrao3887 10 ай бұрын
Can you please help out for small question: Q) How can i get top 3 longest words in a given string using java 8
@sarojsahoo8763
@sarojsahoo8763 3 жыл бұрын
Does stream does parallel operation by default or we need to call parallel stream
@Javatechie
@Javatechie 3 жыл бұрын
No reduction method used parallel execution. We must need to use parallel stream for parallisim
@renejacques8288
@renejacques8288 Жыл бұрын
Why isn't (a,b) -> a+b a bifunction since we have 2 parameters a and b?
@__nitinkumar__
@__nitinkumar__ 3 жыл бұрын
how i->i means it an integer? Can you please explain this...?
@shreeguruprasadnsbhat9172
@shreeguruprasadnsbhat9172 9 ай бұрын
Why we have to use .get() method
@devilscarrybach8672
@devilscarrybach8672 2 жыл бұрын
What is use of map when we can directly use mapToDouble
@sanketskhandekar
@sanketskhandekar 3 жыл бұрын
Nice do you have interview series
@Javatechie
@Javatechie 3 жыл бұрын
Not started yet
@aadarshchowdary
@aadarshchowdary 3 жыл бұрын
Hi,what is the use of identity in reduce can you explain.You have used 0 in sum and 1 in multiplication.
@Javatechie
@Javatechie 3 жыл бұрын
Identity is just initial value . If you observed in iterative approach I took one variable i.e sum=0 That is nothing your identity
@aadarshchowdary
@aadarshchowdary 3 жыл бұрын
@@Javatechie Thanks for the explanation.
@sanketh768
@sanketh768 Жыл бұрын
hello Sir, was very clear with the explanations, so the doubt is last 2 calculations using sum and average they did not use reduce function. Hence can they still be called as reductions? Like every terminator operations like max,min,count etc are called reductions?
@Javatechie
@Javatechie Жыл бұрын
Yes they come under reduction
@sureshmanne7245
@sureshmanne7245 11 ай бұрын
17:00 can we use 2 filters, one to get grade and 2nd one to get salary?
@Javatechie
@Javatechie 11 ай бұрын
Yes you can but why can't we add both conditions in a single filter
@sureshmanne7245
@sureshmanne7245 11 ай бұрын
@@Javatechie I tried but getting conversion error, let me try both conditions in one filter itself
@sameepkaranjkar2263
@sameepkaranjkar2263 2 жыл бұрын
Hi , Any particular reason for having .map(employee -> employee.getSalary()) step in below example ? double sumSalary = EmployeeDatabase.getEmployees().stream() .filter(employee -> employee.getGrade().equalsIgnoreCase("A")) .map(employee -> employee.getSalary()) .mapToDouble(i -> i) .sum(); We could also do it as : EmployeeDatabase.getEmployees().stream() .filter(employee -> employee.getGrade().equalsIgnoreCase("A")) .mapToDouble(employee->employee.getSalary()) .sum();
@Javatechie
@Javatechie 2 жыл бұрын
Yes you are correct we can do that
@gayathrigayu9960
@gayathrigayu9960 3 жыл бұрын
Sir I want file merging using mapreduce in Java coding
@suryaenjarapu
@suryaenjarapu Жыл бұрын
int result = numbers .stream() .reduce(0, (previousReturnedValue, element) -> previousReturnedValue + element);
@ashfaqmohammad1086
@ashfaqmohammad1086 2 ай бұрын
What do you mean by more readable? In the summation example using iterative approach is also much more readable and verbose also, while in streams if some complex operation is being performed, you cannot debug the intermediate state until terminal operation is performed. Traditional approach can be understood by even grade 10 student if he has learnt any programming language, why do we call streams more readable?
@Javatechie
@Javatechie 2 ай бұрын
Hello buddy why can't you debug stream operations? Also when I say readable it means we do method chaining in such a way that it can easily identify what function we are performing in sequence
@mirrabiluddin3798
@mirrabiluddin3798 2 жыл бұрын
Map while Customer Object contains two filed Type and coount .type=I,count=10 ,type=o,count=20 .I want to display another map which contains Map = .eg.Map,MAP and so on. plz help
@Javatechie
@Javatechie 2 жыл бұрын
Not clear please elaborate it
@sanjay26031983
@sanjay26031983 Жыл бұрын
Example : input : { a, b, k, {A, c, G,H,p}} output : {a, b, k, {c,p}} . How to write stream fn for this. Expection is to remove capital letter from list.
@nareshe9906
@nareshe9906 Жыл бұрын
int arr1[] ={1,2,3,4,5}; when you define array as like this instead of Arrays.asList(1,2,3,4,5) how we can achieve iit ?
@Javatechie
@Javatechie Жыл бұрын
Pass this as Stream.of()
@siddhantpatel4768
@siddhantpatel4768 4 ай бұрын
List names = Arrays.asList("mike", "java", "adam", "ram"); here what output i will be expect for longest string?
@Javatechie
@Javatechie 4 ай бұрын
Excellent , i believe it will print all since all words having 4 character
@siddhantpatel4768
@siddhantpatel4768 4 ай бұрын
@@Javatechie yeah ,but it is not possible with reduce method because it will give single output,so what are we do in such situations?.. also your content is lot of helpful for beginners 🙏
@Javatechie
@Javatechie 4 ай бұрын
We can use something like this import java.util.Arrays; import java.util.List; public class Main { public static void main(String[] args) { List stringList = Arrays.asList("Mike", "java"); int maxLength = stringList.stream() .map(String::length) .max(Integer::compare) .orElse(0); stringList.stream() .filter(str -> str.length() == maxLength) .forEach(str -> System.out.println("Longest string: " + str)); } }
@amitkumar-uj8wz
@amitkumar-uj8wz 2 жыл бұрын
sounds quality is not very good
@Javatechie
@Javatechie 2 жыл бұрын
Please try increasing your system volume once and let me know if still clarity is not good
Java Streams - 3 ways to reduce
15:16
Viraj Shetty
Рет қаралды 752
Её Старший Брат Настоящий Джентельмен ❤️
00:18
Глеб Рандалайнен
Рет қаралды 8 МЛН
Countries Treat the Heart of Palestine #countryballs
00:13
CountryZ
Рет қаралды 30 МЛН
Java 8 Streams | map () & flatMap() Example | JavaTechie
15:37
Java Techie
Рет қаралды 205 М.
Java 8 Streams | Optional Usage and Best Practices | JavaTechie
22:22
Java 8 STREAMS Tutorial
18:10
Oggi AI - Artificial Intelligence Today
Рет қаралды 729 М.
Stream API in Java
26:04
Telusko
Рет қаралды 275 М.
Java 8 groupingBy | groupingBy In Streams |Java Shastra
24:28
Java Shastra
Рет қаралды 25 М.
Java Streams: Beyond The Basics
49:21
Jfokus
Рет қаралды 71 М.
Java Streams Tutorial
7:56
Keep On Coding
Рет қаралды 113 М.
WWDC 2024 Recap: Is Apple Intelligence Legit?
18:23
Marques Brownlee
Рет қаралды 6 МЛН
MacBook Air Японский Прикол!
0:42
Sergey Delaisy
Рет қаралды 551 М.
Купил этот ваш VR.
37:21
Ремонтяш
Рет қаралды 265 М.
Bluetooth Desert Eagle
0:27
ts blur
Рет қаралды 8 МЛН
5 НЕЛЕГАЛЬНЫХ гаджетов, за которые вас посадят
0:59
Кибер Андерсон
Рет қаралды 1,6 МЛН