我有static ArrayList<Batch>
。我想删除哪个对象包含产品代码
这是我的批处理实体
public class BatchControl implements Parcelable{
private String productCode;
private String lotNumber;
private String batchSerialNumber;
private double quantity ;
private int sequence;
private String productName;
private String type;
//Setter & getter
}
这是我删除的对象
static ArrayList<String> lstString = new ArrayList<String>();
for (Iterator<Batch> i = lstString.iterator(); i.hasNext(); ) {
Batch value=(Batch )i.next();
if(value.getSequence() == iVal) {
lstString.remove(value);
}
}
iVal
Android TableLayout 包含行号。
String number = txtNumber.getText().toString();
iVal = Integer.parseInt(number);
但它没有删除哪个对象具有 iValue。由于 resoan 静态数组列表,因此每次删除大小时都会发生变化。
请帮帮我。
提前致谢。
最佳答案
您应该使用i.remove(),请引用http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Iterator.html
关于Java static ArrayList<Object> 删除问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10650446/