私は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");
これで、これらすべてのオブジェクトがcombinedListに追加されます
List combinedList = new ArrayList<SchoolStudents>();
次の基準に基づいて、このcombinedListから重複するオブジェクトを削除したいと思います。fNameが同じ場合、またはuNameが同じ場合。