How to find highest salary employee using Java 8 stream API |
SJ Programming Solutions SJ Programming Solutions
5.37K subscribers
450 views
0

 Published On Feb 1, 2024

How to find the employee which is having highest salary in the organization ?
Print the employee which is having maximum salary using java8 stream API?
Java8 stream API sorted method

Hello All,

In this video we will see how to find highest salary employee in the organization using java 8 stream API?

Employee employee = empList.stream().sorted(Comparator.comparing(Employee::getSalary).reversed()).findFirst().get();

System.out.println(" Highest salary employee is : "+employee);

#javainterviewquestions #interviewquestions #preparation #java8stream

show more

Share/Embed