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.
@kshitijbansal36722 жыл бұрын
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.
@Vithal_Nivargi2 жыл бұрын
Thank you please make one more video on Java8 coding questions
@zuberdiwan81232 жыл бұрын
Very Nice Video. very well Explained. Thank You.......
@SivaReddyJavaTechie2 жыл бұрын
You are most welcome
@JameS009892 жыл бұрын
Amazing video Shiva much appreciated
@SivaReddyJavaTechie2 жыл бұрын
Glad you liked it
@muchukundareddy53152 жыл бұрын
Hi Siva, I tried Lambda expression as input for "Comparator.comparing" It was not working
@kemparaj5652 жыл бұрын
Amazing explanation. Thank You 😊. Could have formatted the code. Few parts of code is missing.
@lakshmidevilakshmidevi3984 Жыл бұрын
Thank you for sharing your knowledge with us Sir
@TheChillGuyVlogs2 жыл бұрын
what is the name of the background music?
@rajuls61013 жыл бұрын
Sir can you answer this select employee where department is technology and location not equal to mumbai..
@ShinAkuma2 жыл бұрын
filter( e -> "technology".equals(e.getTechnology()) && !( "mumbai".equals(e.getCity()) ) )
@deepa8177 Жыл бұрын
great video specially quetsion no 5.
@maheshuma7412 жыл бұрын
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 Жыл бұрын
thanks fro sharing..
@InterviewDOT3 жыл бұрын
Very nice thanks for sharing 👌🙏
@riteshchiddarwar98813 жыл бұрын
@siva, its very useful for quick review of java 8 streams. Very nice example you taken and explained . 👍 very best and helpful.
sir plz upload hai video where u would teach run time question only.............Request by your suscriber
@SivaReddyJavaTechie4 жыл бұрын
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);});