Featured

Java 8 coding interview questions - Employee Management System | Real time Interview Questions #java



Published
#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 !
Category
Job
Be the first to comment