我有一个Java类
class Students{
private String fName;
private String lName;
private String uName;
public Students(String fName, String lName, String uName) {
this.fName = fName;
this.lName = lName;
this.uName = uName;
}
public String getuName() {
return uName;
}
public void setuName(String uName) {
this.uName = uName;
}
public String getfName() {
return fName;
}
public void setfName(String fName) {
this.fName = fName;
}
public String getlName() {
return lName;
}
public void setlName(String lName) {
this.lName = lName;
}
}
现在我将对象创建为;
Students students1 = new Students("har","mat","harmat");
Students students2 = new Students("pan","son","panson");
Students students3 = new Students("yogi","jos","yogijos");
Students students4 = new Students("har","mat","harmat");
Students students5 = new Students("pan","son","harmat");
Students students6 = new Students("yogi","jos","someotherUName");
Students students7 = new Students("yogi","jos","someotherUName2");
现在所有这些对象都被添加到 combineList
List combinedList = new ArrayList<SchoolStudents>();
我想根据以下条件从此组合列表中删除重复的对象;如果 fName 相同或 uName 相同。