Java 8 coding interview questions - Employee Management System | Real time Interview Questions
SJ Programming Solutions SJ Programming Solutions
5.98K subscribers
304 views
12

 Published On May 31, 2024

#javainterviewquestionsanswers #javainterview #java8 #javastreams

Hello All,

In this video we will see top 10 Java interview questions on stream API topic.

Question 1 :

Print the employee having the highest salary .
Solution:
Employee employee = empList.stream().
collect(Collectors.maxBy(Comparator.comparingDouble(Employee::getSalary))).get();
System.out.println(employee);

Question 2:

How many male and female employees are there in the list.

Question 3:

How many employees are there in per department.

To solve above two questions we will use groupingBy method.

Thank you !

show more

Share/Embed