I have a map with the structure as Map<String, List<EmployeeIncome>>
where the key holds the employee Id and the Employee Income holds the employee details such as empName, empCompany,incomeSrc.The source of income might be multiple (salary , house let out for rent etc).
public class EmployeeIncome{
private String empName;
private String empCompany;
private String incomeSrc;
public String getEmpName() {
return empName;
}
public void setEmpName(String empName) {
this.empName = empName;
}
public String getEmpCompany() {
return empCompany;
}
public void setEmpCompany(String empCompany) {
this.empCompany = empCompany;
}
public String getIncomeSrc() {
return incomeSrc;
}
public void setIncomeSrc(String incomeSrc) {
this.incomeSrc = incomeSrc;
}
}
The employee company name will be unique for an employee id will be the same in all case of income source.Now maps contains multiple data of employee, i would like to sort the map based on employee name.Though I am trying to use Comparator and trying out but not able to get the desired output.
Thanks in advance.