版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wxm994116/article/details/78500861
关于移除List中元素的相关例子
正常移除list中元素,通过迭代来进行处理!
具体通过以下代码来说明
//map.get(str)获取到的是满足条件的分类好的细单数据
List<AppPriceAffirmDetail> a = map.get(str);
// 判断如果未中标的就把他移除掉,只显示中标的供应商,判断标志就是通过IsSetPriceBill这个字段值为true或者false来判断
if (a.size() > 0) {
Iterator<AppPriceAffirmDetail> it = a.iterator();
while (it.hasNext()) {
AppPriceAffirmDetail temp = it.next();
if (temp.getIsSetPriceBill().equals(false)) {
//非中标,就移除掉
it.remove();
}
}
}
以上是小编开发中做到的一点小经验,有需要的可以自行阅读与采纳,如果给力就点个赞再走哦!如转发需要注明文章的出处,谢谢!