Find Nth Highest salary using Java 8 Stream API

preview_player
Показать описание
​ @AS Learning

Java Interview questions -

SQL INTERVIEW QUESTIONS PLAYLIST -
Комментарии
Автор

Is it for freshers r experience interview question sir?

pradeeplk
Автор

if 3rd highest same salary contains 10 members and i want get total 3rd highest salary members then how to write

noors
Автор

Can you write a program to get top 5 salaries and Employees name given they have Employee ID, Employee NAme, Employee Department, Employee Salary, Employee isActive boolean true property.



Please explain in easy words and execute and write program using java 8 functional programming features and streams to Pick only the TOP 5 salary and top 5 Employee Name only.



I tried with this following approach but interviewer rejected me and i am not able to solve. Please explain how to write the solution because i am crying so much.

public class Employee {

//id, name, department, salary, isActive;

//Find out top 5 IT department, <50 K, isActive='true'

public static void main(String[] args)

{

// TODO Auto-generated method stub

// topEmployeeList = allEmployeeList.stream()

.filter(department=='IT')

.filter(salary<50000)

.filter(isActive==true)

.collect(groupingBy(e->e.department,



}



}

alok