I have collection of employees with states as name,salary,id.
TreeSet ts=new TreeSet();
ts.add(new Employee("neeraj", 10000, 123));
ts.add(new Employee("neeraj", 10000, 789));
ts.add(new Employee("ankit", 30000, 345));
ts.add(new Employee("ankit", 40000, 456));
How to sort employees with unique name on basis of salary?