Java 8 Streams programs you must prepare for Java Interviews
ฝัง
- เผยแพร่เมื่อ 27 ม.ค. 2021
- 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
Great and wonderful example for Stream API.... Great!!!!!
Glad you liked it!
Very nice thanks for sharing 👌🙏
Wonderful explanation with example. Thank you so much. Will be waiting to see more videos.. 👏🏻👌🏻🙏🏻👍
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
th-cam.com/video/WmxlNpEfL04/w-d-xo.html
Thank you for sharing your knowledge with us Sir
super siva , good keep it up. its 13 years since we met.
Amazing video Shiva much appreciated
Glad you liked it
excellent sir.. Thank you
Excellent
Thank you please make one more video on Java8 coding questions
great video specially quetsion no 5.
Nice sir 👌
Thanks siva!
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.
thanks fro sharing..
@siva, its very useful for quick review of java 8 streams. Very nice example you taken and explained . 👍 very best and helpful.
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
th-cam.com/video/WmxlNpEfL04/w-d-xo.html
Thanks sir, very nicely explained
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
th-cam.com/video/WmxlNpEfL04/w-d-xo.html
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
th-cam.com/video/WmxlNpEfL04/w-d-xo.html
Very helpful videos,make more such java8 programming videos....thanks a lot sir
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
th-cam.com/video/WmxlNpEfL04/w-d-xo.html
Very Nice Video. very well Explained. Thank You.......
You are most welcome
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.
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.
clear explanation and thanks
Glad you liked it
nice explanation sir
Thanks sir very useful
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
th-cam.com/video/WmxlNpEfL04/w-d-xo.html
Tq
Amazing explanation. Thank You 😊. Could have formatted the code. Few parts of code is missing.
Excellent video
Thank you very much!
Nice video.. very nicely explain.. Can you please explain the reducing function example.
thanks
Thanks Nagesh. Please refer our TH-cam Channel to your friends and colleagues as it may helpful for them. Happy learning.
Hi Siva, I tried Lambda expression as input for "Comparator.comparing" It was not working
U r brilliant sir
Thanks Amit. Please share our TH-cam channel to your friends circle as it may be helpful for them. Happy Learning.
@@SivaReddyJavaTechie Sure Sir
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
th-cam.com/video/WmxlNpEfL04/w-d-xo.html
NYC information 22:33
Sir can you answer this select employee where department is technology and location not equal to mumbai..
filter( e -> "technology".equals(e.getTechnology()) && !( "mumbai".equals(e.getCity()) ) )
what is the name of the background music?
Sir a git hub link would have been helpful
Filter?
Sir outer joins practice questions plz..scenario based
Sure. I will upload soon.
@@SivaReddyJavaTechie waiting..I'm still confused abt tht topic...
Sure. I will upload video on the requested topic as soon as possible
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
th-cam.com/video/WmxlNpEfL04/w-d-xo.html
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 🙏
Hi Pratap, Good suggestion. I make a note of it and will do same for future videos.
@@SivaReddyJavaTechie Thank you 🙏
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
th-cam.com/video/WmxlNpEfL04/w-d-xo.html
hi siva,
can u give code github url?
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
th-cam.com/video/WmxlNpEfL04/w-d-xo.html
Sir can you help me to slove my assignment programs in Java
how to find sum of the salary of each department????
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()));
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 ?
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
th-cam.com/video/WmxlNpEfL04/w-d-xo.html
sir plz upload hai video where u would teach run time question only.............Request by your suscriber
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.
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
th-cam.com/video/WmxlNpEfL04/w-d-xo.html
Sir how to get second max salary
//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);
sir send the code
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
th-cam.com/video/WmxlNpEfL04/w-d-xo.html
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);});