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.
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.
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.
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);});
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.
Great and wonderful example for Stream API.... Great!!!!!
Glad you liked it!
super siva , good keep it up. its 13 years since we met.
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..
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
ua-cam.com/video/WmxlNpEfL04/v-deo.html
Thank you please make one more video on Java8 coding questions
Thank you for sharing your knowledge with us Sir
Amazing explanation. Thank You 😊. Could have formatted the code. Few parts of code is missing.
Very Nice Video. very well Explained. Thank You.......
You are most welcome
great video specially quetsion no 5.
Hi Siva, I tried Lambda expression as input for "Comparator.comparing" It was not working
Very nice thanks for 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
ua-cam.com/video/WmxlNpEfL04/v-deo.html
Excellent video
Thank you very much!
excellent sir.. Thank you
clear explanation and thanks
Glad you liked it
Amazing video Shiva much appreciated
Glad you liked it
Thanks sir, very nicely explained
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
ua-cam.com/video/WmxlNpEfL04/v-deo.html
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
ua-cam.com/video/WmxlNpEfL04/v-deo.html
what is the name of the background music?
nice explanation sir
Very helpful videos,make more such java8 programming videos....thanks a lot sir
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
ua-cam.com/video/WmxlNpEfL04/v-deo.html
Thanks siva!
Nice video.. very nicely explain.. Can you please explain the reducing function example.
Tq
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()) ) )
U r brilliant sir
Thanks Amit. Please share our UA-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
ua-cam.com/video/WmxlNpEfL04/v-deo.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
ua-cam.com/video/WmxlNpEfL04/v-deo.html
Excellent
thanks
Thanks Nagesh. Please refer our UA-cam Channel to your friends and colleagues as it may helpful for them. Happy learning.
Thanks sir very useful
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
ua-cam.com/video/WmxlNpEfL04/v-deo.html
NYC information 22:33
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
ua-cam.com/video/WmxlNpEfL04/v-deo.html
Nice sir 👌
Sir a git hub link would have been helpful
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()));
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);
hi siva,
can u give code github url?
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
ua-cam.com/video/WmxlNpEfL04/v-deo.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
ua-cam.com/video/WmxlNpEfL04/v-deo.html
Sir can you help me to slove my assignment programs in Java
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
ua-cam.com/video/WmxlNpEfL04/v-deo.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);});
sir send the code
HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
ua-cam.com/video/WmxlNpEfL04/v-deo.html