Thursday, April 6, 2023

Java8 streams Interview Quetions

1. Secound Highest Salary

Optional<Integer> secondHighestSalary = employees.stream().map(Employee::getSalary).distinct()

.sorted(Comparator.reverseOrder()).skip(1).findFirst();



No comments:

Post a Comment