public class Employee implements Comparable<Employee> {
private int id;
private String name;
private String salary;
private String recordStatus;
private int key;
public Employee(int id, String name, String salary, int key) {
super();
this.id = id;
this.name = name;
this.salary = salary;
this.key = key;
}
}
Now I have a list of type Employee.
List<Employee> list = new ArrayList<Employee>();
list.add(new Employee(123, "zMadhu", "1000$",1));
list.add(new Employee(332, "bSudhan", "2000$",2));
list.add(new Employee(54, "cKongarass", "3000$",3));
list.add(new Employee(54, "xKongarass", "3000$",4));
list.add(new Employee(54, "aKongarass", "3000$",5));
Now I want to remove data from this list and have only unique IDS. I.E. I am expecting 54,123,332 in another list of type Employee.
Want to see how I can do it. Much appreciate your help here.