List删除某一个Object

1.直接删除:

 List<LineShop> tlineprices  = new ArrayList<>();

 tlineprices.remove(0);

2.使用遍历删除(iterator):

 List<LineShop> tlineprices = new ArrayList<>();
        Iterator<LineShop> it = tlineprices.iterator();
        while (it.hasNext()) {
LineShop lineShop = (LineShop) it.next();
if(lineShop.getUid().equals(uid)){
it.remove();
}
}

相关文章:

  • 2022-12-23
  • 2020-04-02
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案
粤ICP备22038628号Powered By WordPress