@Data
public class ResResult {
private String combineId;//检测组合
private String sid;//样本号
private String itemCode;//项目代码
public ResResult(String combineId, String sid, String itemCode) {
this.combineId = combineId;
this.sid = sid;
this.itemCode = itemCode;
}
public ResResult( ) {
}
}
@Test
public void contextLoads() {
List<ResResult> result = new ArrayList<ResResult>();
ResResult R1 = new ResResult("ts","111","hcg");
ResResult R2 = new ResResult("ts","222","afp");
ResResult R3 = new ResResult("ts","333","papp_a");
result.add(R1);
result.add(R2);
result.add(R3);result.remove(1);//根据下标删除第2个对象
//ResResult resResult = result.get(1);
//result.remove(resResult);//删除ii对应的
result.set(1,new ResResult("ts","222333","afp"));//覆盖列表中的第二个对象
}