No video

Java 8 Streams programs you must prepare for Java Interviews

  Рет қаралды 85,432

Siva Reddy

Siva Reddy

Күн бұрын

Below are the frequently asked programs during the coding round in java interviews. In this video, I explain the below programs in detail.
Please make sure, you prepare well for the below programs.
1.Write a program to print employee details working in each department
2.Write a program to print employees count working in each department
3.Write a program to print active and inactive employees in the given collection
4.Write a program to print Max/Min employee salary from the given collection
5.Write a program to print the max salary of an employee from each department

Пікірлер: 77
@maheshuma741
@maheshuma741 2 жыл бұрын
To calculate dept wise statistics like min,max,average we can use following code : empList.stream.collect(Collectors.groupingBy(Employee::getDeptId, Collectors. summarizingDouble(Employee::getSal))) ; it returns Map . Just for knowledge purpose sharing my thoughts.. Don't take it in another way.
@deepa8177
@deepa8177 6 ай бұрын
thanks fro sharing..
@SandeepKumar-se2fd
@SandeepKumar-se2fd 2 жыл бұрын
Great and wonderful example for Stream API.... Great!!!!!
@SivaReddyJavaTechie
@SivaReddyJavaTechie Жыл бұрын
Glad you liked it!
@venkatsam2472
@venkatsam2472 3 жыл бұрын
Wonderful explanation with example. Thank you so much. Will be waiting to see more videos.. 👏🏻👌🏻🙏🏻👍
@javatech8530
@javatech8530 2 жыл бұрын
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers kzfaq.info/get/bejne/jdOon7GhqsywYGg.html
@maheshuma741
@maheshuma741 2 жыл бұрын
Thank you sir for making this video. . To get active and Inactive works in a single Iteration we can use partitionBy() method. Sample Code : employeeList.stream().collect( Collectors.partitioningBy(emp->"active".equalsIgnoreCase(emp.getName())) , It returns Map . At the calling place map.get(true) for active and map.get(false) for inactive.. We have n number of ways it is the one of the way.
@kshitijbansal3672
@kshitijbansal3672 Жыл бұрын
Can we do like this also? List.stream(). collect (Collectors.groupingBy(Employee: getStatus(), Collectors.counting()); It will first group by on basis of Active and Inactive and then count it.
@venkatesha6378
@venkatesha6378 10 ай бұрын
super siva , good keep it up. its 13 years since we met.
@lakshmidevilakshmidevi3984
@lakshmidevilakshmidevi3984 10 ай бұрын
Thank you for sharing your knowledge with us Sir
@rajuls6101
@rajuls6101 2 жыл бұрын
Sir can you answer this select employee where department is technology and location not equal to mumbai..
@ShinAkuma
@ShinAkuma 2 жыл бұрын
filter( e -> "technology".equals(e.getTechnology()) && !( "mumbai".equals(e.getCity()) ) )
@start1learn-n171
@start1learn-n171 5 ай бұрын
Tq
@Vithal_Nivargi
@Vithal_Nivargi Жыл бұрын
Thank you please make one more video on Java8 coding questions
@zuberdiwan8123
@zuberdiwan8123 Жыл бұрын
Very Nice Video. very well Explained. Thank You.......
@SivaReddyJavaTechie
@SivaReddyJavaTechie Жыл бұрын
You are most welcome
@muchukundareddy5315
@muchukundareddy5315 Жыл бұрын
Hi Siva, I tried Lambda expression as input for "Comparator.comparing" It was not working
@deepa8177
@deepa8177 6 ай бұрын
great video specially quetsion no 5.
@InterviewDOT
@InterviewDOT 3 жыл бұрын
Very nice thanks for sharing 👌🙏
@pratapjavasingh3239
@pratapjavasingh3239 3 жыл бұрын
I can request u sir whenever u writing the codes then atleast first explain predefined method apart from that then u can write the code it's request 🙏
@SivaReddyJavaTechie
@SivaReddyJavaTechie 3 жыл бұрын
Hi Pratap, Good suggestion. I make a note of it and will do same for future videos.
@pratapjavasingh3239
@pratapjavasingh3239 3 жыл бұрын
@@SivaReddyJavaTechie Thank you 🙏
@javatech8530
@javatech8530 2 жыл бұрын
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers kzfaq.info/get/bejne/jdOon7GhqsywYGg.html
@maheshd3506
@maheshd3506 2 жыл бұрын
clear explanation and thanks
@SivaReddyJavaTechie
@SivaReddyJavaTechie Жыл бұрын
Glad you liked it
@JameS00989
@JameS00989 2 жыл бұрын
Amazing video Shiva much appreciated
@SivaReddyJavaTechie
@SivaReddyJavaTechie Жыл бұрын
Glad you liked it
@SuccessToSamadhi
@SuccessToSamadhi Жыл бұрын
excellent sir.. Thank you
@poojas1600
@poojas1600 Жыл бұрын
Excellent video
@SivaReddyJavaTechie
@SivaReddyJavaTechie Жыл бұрын
Thank you very much!
@coincidentIndia
@coincidentIndia 2 жыл бұрын
why using reducing ? we can directly use the maxBy on groupBy DepartmentId. Map maxSalaryByDept = employeeList.stream().collect(Collectors.groupingBy(Employee::getEmployeeDepartmentId, Collectors.maxBy(Comparator.comparing(Employee::getSalary)))); maxSalaryByDept.forEach((k,v)->{System.out.println("Dept "+k+" Salary "+v);});
@kemparaj565
@kemparaj565 2 жыл бұрын
Amazing explanation. Thank You 😊. Could have formatted the code. Few parts of code is missing.
@chetandy2573
@chetandy2573 3 жыл бұрын
Thanks sir, very nicely explained
@javatech8530
@javatech8530 2 жыл бұрын
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers kzfaq.info/get/bejne/jdOon7GhqsywYGg.html
@javatech8530
@javatech8530 2 жыл бұрын
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers kzfaq.info/get/bejne/jdOon7GhqsywYGg.html
@thebaseofpcmbclasses8028
@thebaseofpcmbclasses8028 Жыл бұрын
nice explanation sir
@Proman.Offbeat.Traveller
@Proman.Offbeat.Traveller Жыл бұрын
NYC information 22:33
@indranildas8485
@indranildas8485 2 жыл бұрын
what is the name of the background music?
@DMvali
@DMvali 2 жыл бұрын
Thanks siva!
@bacchaparty6275
@bacchaparty6275 3 жыл бұрын
U r brilliant sir
@SivaReddyJavaTechie
@SivaReddyJavaTechie 3 жыл бұрын
Thanks Amit. Please share our KZfaq channel to your friends circle as it may be helpful for them. Happy Learning.
@bacchaparty6275
@bacchaparty6275 3 жыл бұрын
@@SivaReddyJavaTechie Sure Sir
@javatech8530
@javatech8530 2 жыл бұрын
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers kzfaq.info/get/bejne/jdOon7GhqsywYGg.html
@riteshchiddarwar9881
@riteshchiddarwar9881 3 жыл бұрын
@siva, its very useful for quick review of java 8 streams. Very nice example you taken and explained . 👍 very best and helpful.
@javatech8530
@javatech8530 2 жыл бұрын
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers kzfaq.info/get/bejne/jdOon7GhqsywYGg.html
@mamatharao2127
@mamatharao2127 2 жыл бұрын
Excellent
@adityapratapsingh7311
@adityapratapsingh7311 3 жыл бұрын
Very helpful videos,make more such java8 programming videos....thanks a lot sir
@javatech8530
@javatech8530 2 жыл бұрын
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers kzfaq.info/get/bejne/jdOon7GhqsywYGg.html
@enlightened7354
@enlightened7354 Жыл бұрын
Filter?
@knowledgeshare1622
@knowledgeshare1622 Жыл бұрын
how to find sum of the salary of each department????
@jeckrazi7691
@jeckrazi7691 Жыл бұрын
Map mapEmpDept = empList.stream().collect(Collectors.groupingBy(Employee::getDept, Collectors.summarizingInt(Employee::getSalary))); mapEmpDept.entrySet().forEach(entry -> System.out.println("Dept:: " + entry.getKey() + " & Sum:: " + entry.getValue().getMin()));
@I-can-do-that-1
@I-can-do-that-1 3 жыл бұрын
thanks
@SivaReddyJavaTechie
@SivaReddyJavaTechie 3 жыл бұрын
Thanks Nagesh. Please refer our KZfaq Channel to your friends and colleagues as it may helpful for them. Happy learning.
@abhishekjain6559
@abhishekjain6559 2 жыл бұрын
Nice video.. very nicely explain.. Can you please explain the reducing function example.
@srinivass5552
@srinivass5552 3 жыл бұрын
Thanks sir very useful
@javatech8530
@javatech8530 2 жыл бұрын
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers kzfaq.info/get/bejne/jdOon7GhqsywYGg.html
@vikrantharne5269
@vikrantharne5269 3 жыл бұрын
Sir outer joins practice questions plz..scenario based
@SivaReddyJavaTechie
@SivaReddyJavaTechie 3 жыл бұрын
Sure. I will upload soon.
@vikrantharne5269
@vikrantharne5269 3 жыл бұрын
@@SivaReddyJavaTechie waiting..I'm still confused abt tht topic...
@SivaReddyJavaTechie
@SivaReddyJavaTechie 3 жыл бұрын
Sure. I will upload video on the requested topic as soon as possible
@javatech8530
@javatech8530 2 жыл бұрын
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers kzfaq.info/get/bejne/jdOon7GhqsywYGg.html
@errahulrajocjp
@errahulrajocjp 2 жыл бұрын
Hello Sir ! Thank you for explanation. Q 5) Dept 103 having two employee having same salary 3500, but showing only one employee as a result ?
@javatech8530
@javatech8530 2 жыл бұрын
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers kzfaq.info/get/bejne/jdOon7GhqsywYGg.html
@gottepavani1838
@gottepavani1838 Жыл бұрын
Sir how to get second max salary
@jeckrazi7691
@jeckrazi7691 Жыл бұрын
//Second Minimum Salary empList.stream().sorted(Comparator.comparing(Employee::getEmpSalary)).skip(1).limit(1).forEach(System.out::println); //Second Maximum Salary myEmployee_Demo.stream().sorted((e1,e2)-> (e1.getEmpSalary() < e2.getEmpSalary()) ? 1 : ((e1.getEmpSalary() == e2.getEmpSalary()) ? 0 : -1)).skip(1).limit(1).forEach(System.out::println);
@anandpadamala3586
@anandpadamala3586 3 жыл бұрын
Nice sir 👌
@dharamkirti24
@dharamkirti24 2 жыл бұрын
Sir a git hub link would have been helpful
@chinnimounika8645
@chinnimounika8645 2 жыл бұрын
Sir can you help me to slove my assignment programs in Java
@CodeUpskill
@CodeUpskill 2 жыл бұрын
hi siva, can u give code github url?
@javatech8530
@javatech8530 2 жыл бұрын
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers kzfaq.info/get/bejne/jdOon7GhqsywYGg.html
@morning8474
@morning8474 3 жыл бұрын
sir plz upload hai video where u would teach run time question only.............Request by your suscriber
@SivaReddyJavaTechie
@SivaReddyJavaTechie 3 жыл бұрын
The intention is to emphasis on the importance of these programs so that viewers can pay more attention to prepare for the same and will get benefit in the interview.
@javatech8530
@javatech8530 2 жыл бұрын
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers kzfaq.info/get/bejne/jdOon7GhqsywYGg.html
@palanirajkumar4904
@palanirajkumar4904 3 жыл бұрын
sir send the code
@javatech8530
@javatech8530 2 жыл бұрын
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers kzfaq.info/get/bejne/jdOon7GhqsywYGg.html
Stream API in Java
26:04
Telusko
Рет қаралды 306 М.
黑天使遇到什么了?#short #angel #clown
00:34
Super Beauty team
Рет қаралды 35 МЛН
لااا! هذه البرتقالة مزعجة جدًا #قصير
00:15
One More Arabic
Рет қаралды 50 МЛН
Java 8 Streams | map () & flatMap() Example | JavaTechie
15:37
Java Techie
Рет қаралды 212 М.
Cracking the coding interview || Java streams Coding questions
20:31
Java 8 Streams 🔥  | 10 IMPORTANT Coding Questions & Answers | Streams API
28:15
Code With Ease - By Varsha
Рет қаралды 13 М.
The 25 SQL Questions You MUST Know for Data Analyst Interviews
32:47
KSR Datavizon
Рет қаралды 211 М.
Java 8 Coding and Programming Interview Questions and Answers
59:21
Gain Java Knowledge
Рет қаралды 2,8 М.
黑天使遇到什么了?#short #angel #clown
00:34
Super Beauty team
Рет қаралды 35 МЛН